Notification Events: Possible to set mail headers?
Moderator: crythias
-
- Znuny advanced
- Posts: 146
- Joined: 11 Apr 2011, 08:11
- Znuny Version: 3.2.5
Notification Events: Possible to set mail headers?
Hi,
we're using customer notifications on new/close tickets. Now, with such mails, we want to trigger an Action on a mail server - but the necessary information should not be visible for the user: i.e. we want to have the Queuename sent as an emails X-header, not within the body. If there's no easy possibility, maybe we'd have to delete the respective line from the body after doing the magic.
Anyone ever accomplished this?
TIA
Michael
we're using customer notifications on new/close tickets. Now, with such mails, we want to trigger an Action on a mail server - but the necessary information should not be visible for the user: i.e. we want to have the Queuename sent as an emails X-header, not within the body. If there's no easy possibility, maybe we'd have to delete the respective line from the body after doing the magic.
Anyone ever accomplished this?
TIA
Michael
-
- Znuny expert
- Posts: 250
- Joined: 12 Oct 2010, 01:35
- Znuny Version: 3.0.9
- Company: LRS Health
Re: Notification Events: Possible to set mail headers?
I've set custom X-headers when sending emails (High Importance & Read-Receipt). It is possible
OTRS: 3.0.9 & ITSM 3.0.4 - OS: Windows 7 - DB: MySQL - Heaps of random/useful hacks
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
-
- Znuny advanced
- Posts: 146
- Joined: 11 Apr 2011, 08:11
- Znuny Version: 3.2.5
Re: Notification Events: Possible to set mail headers?
Well, greatMichaelR wrote:I've set custom X-headers when sending emails (High Importance & Read-Receipt). It is possible
[ ] Easily possible, configurable
[ ] Possible
[ ] 100 days of code auditing plus 50 days of implementation
[x] -v:
[____________________________________]
-
- Znuny expert
- Posts: 241
- Joined: 06 Feb 2009, 11:15
- Znuny Version: 3.0.x
- Company: Perl-Services.de
- Contact:
Re: Notification Events: Possible to set mail headers?
These mail headers should be set in the customer notification sent from OTRS, right?
Then you have to add a some lines of code in Kernel/System/Email.pm and Kernel/System/Ticket/Event/NotificationEvent.pm:
In Kernel::System::Email:
(somewhere near $Header{'X-Mailer'} = "$Product Mail Service ($Version)";)
In Kernel::System::Ticket::Event::NotificationEvent replace
with
This code is untested!
Then you have to add a some lines of code in Kernel/System/Email.pm and Kernel/System/Ticket/Event/NotificationEvent.pm:
In Kernel::System::Email:
Code: Select all
for my $HeaderKey ( grep{ m{\AX-} }keys %Param ) {
$Header{$HeaderKey} = $Param{$HeaderKey};
}
In Kernel::System::Ticket::Event::NotificationEvent replace
Code: Select all
$Self->{SendmailObject}->Send(
From => $From,
Code: Select all
$Self->{SendmailObject}->Send(
From => $From,
'X-OTRS-Queue' => $Article{Queue},
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
-
- Znuny advanced
- Posts: 146
- Joined: 11 Apr 2011, 08:11
- Znuny Version: 3.2.5
Re: Notification Events: Possible to set mail headers?
Thanks... I tested it - unfortunately it does not add a header
-
- Znuny expert
- Posts: 241
- Joined: 06 Feb 2009, 11:15
- Znuny Version: 3.0.x
- Company: Perl-Services.de
- Contact:
Re: Notification Events: Possible to set mail headers?
It should add a header - I've just tested it. So it is an event notification, isn't it??
I have to look at MIME::Entity why "X-OTRS-TestHeader" is changed to "X-Otrs-Testheader"...
I have to look at MIME::Entity why "X-OTRS-TestHeader" is changed to "X-Otrs-Testheader"...
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
-
- Znuny expert
- Posts: 250
- Joined: 12 Oct 2010, 01:35
- Znuny Version: 3.0.9
- Company: LRS Health
Re: Notification Events: Possible to set mail headers?
My method is more hack-job'y but it works fine, I had issues with adding the 'Disposition-Notification-To' header before the MIME:Entity was built, as it was removing/screwing it up.
I have a checkbox in the .dtl that passes a parameter through to Email.pm, and depending on if the checkbox is ticked or not.
Part of my code is:
This is performed after the Entity is built.
It works fine for me and everyone is happy
I have a checkbox in the .dtl that passes a parameter through to Email.pm, and depending on if the checkbox is ticked or not.
Part of my code is:
Code: Select all
if ( defined $Param{Priority} ) {
$Header->replace('X-Priority', '1');
} else {
$Header->replace('X-Priority', '3');
}
Code: Select all
my $Entity = MIME::Entity->build( %Header, Data => $Param{Body} );
# set In-Reply-To and References header
my $Header = $Entity->head;
OTRS: 3.0.9 & ITSM 3.0.4 - OS: Windows 7 - DB: MySQL - Heaps of random/useful hacks
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
[Major Code Changes]
ArticleFreeTime1-3
Ability to search ArticleFreeText
Re: Notification Events: Possible to set mail headers?
how can I use this with Dynamic Fields?
OTRS Ver. 3.1.3 on Ubuntu 10.04 with MySQL database 5.1.49