Open samueldc opened 1 year ago
I'm not a SMPT header specialist, but suggest the following code after $RealFrom
definition, but right before saving the message to the queue:
# adjust from header with real from
$Param{Header} =~ s{(\X*?From: \X+?<).+?(>\X+)}{$1$RealFrom$2}img;
Hi @samueldc
the "From" header is not set by the SendmailNotificationEnvelopeFrom setting. The purpose of this setting is to set the "Envelope From" header. The From header of a notification is set by the NotificationSenderEmail setting.
So please use this setting, then it should be fine.
Kai
Hi @KaiHerlemann Thanks for replying. Already tried NotificationSenderEmail. It's not working also.
The only pertinent reference to the NotificationSenderEmail configuration parameter occurs within the Kernel::System::Ticket::Event::NotificationEvent::Transport::Email class when the recipient type is set to 'Agent'.
When the recipient type is 'Customer,' the NotificationSenderEmail parameter appears to have no effect.
Although this behavior is not clearly stated in the parameter's description, in my opinion, the use case for this configuration parameter would be more logical if it were applicable when the recipient type is 'Customer'.
It's true that the setting is not relevant when notifications go to the customer user. (I didn't know this issue is about notifications to customers and not agents.)
If a reply, outgoing email or ticket notification is sent to the customer user, the "From" address is always the system address of the queue. In those cases, neither the NotificationSenderEmail nor SendmailNotificationEnvelopeFrom setting is relevant. There is one exception, for auto-responses it's the system address, which is set in the auto-response settings.
Environment
Expected behaviour
SendmailNotificationEnvelopeFrom config parameter should change the From header of notification messages.
Actual behaviour
SendmailNotificationEnvelopeFrom has no effect in the From header because the header section is formed before SendmailNotificationEnvelopeFrom config parameter check. And after that the header section is not adjusted (I suggest a regex substitution). SendmailNotificationEnvelopeFrom is only used in the
$smtp->mail
method with no effect in the actual message.Kernel::System::Email::636 (version 7.0):
Kernel::System::Email:SMTP::307 (version 7.0):
How to reproduce
Steps to reproduce the behavior: