Bug #94350
openImpossible to add Return-path to email in TYPO3 v. 10
0%
Description
The code below tries to add a bounce account as return path, but $senderEmail is used ad Return-Path in final mail header... - worked like a charm in TYPO3 v. 9
$subject = 'Test mail';
$bounceEmail = 'bounce@typoconsult.dk';
$senderName = 'TypoConsult';
$senderEmail = 'info@typoconsult.dk';
$fromAddress = new Address($senderEmail, $senderName);
$mail = GeneralUtility::makeInstance(MailMessage::class);
$mail->to(new Address('ch@typoconsult.dk'));
$mail->subject($subject);
$mail->returnPath(new Address($bounceEmail));
$mail->from($fromAddress);
$mail->replyTo($fromAddress);
$mail->sender($fromAddress);
$mail->html('This is a <b>test</b> mail...');
$mail->send();
Mail configuration is: /usr/sbin/sendmail -t -i
See attached image
Files
Updated by Claus Harup over 3 years ago
Claus Harup wrote:
The code below tries to add a bounce account as return path, but $senderEmail is used ad Return-Path in final mail header... - worked like a charm in TYPO3 v. 9
[...]
Mail configuration is: /usr/sbin/sendmail -t -i
See attached image
Don't use ReturnPath - set Sender instead. Support for the ReturnPath property was recently disabled in PHPMailer (in version 5.2.8) because it's invalid to set it at the point of sending. The return path is added by the receiver when it receives the message, and is set by putting your desired return path into the Sender property, which gets passed as the envelope sender during the SMTP conversation. Sender is set automatically when you call setFrom, but you can override it and just set it directly
Updated by Oliver Bartsch about 3 years ago
- Status changed from New to Needs Feedback
Hi, is this issue still relevant?
Updated by Alex Kellner over 2 years ago
It's still used in powermail. If there is a breaking change, we would have to adopt it - see https://github.com/einpraegsam/powermail/issues/668
Updated by Juergen Waelther about 2 years ago
There is an solution in newer Symfony Mime/Mailer versions, see https://github.com/symfony/symfony/issues/41322.
Should this updated in the Typo3 core packages?
Updated by Michal Cygankiewicz almost 2 years ago
I have same issue - is there any known solution that can be applied to TYPO3 10?
Updated by Juergen Waelther over 1 year ago
@Michal Cygankiewicz , as a workaround change order in component symfony/mailer file DelayedEnvelope.php as described here and it works:
https://github.com/symfony/symfony/issues/41322#issuecomment-1049776517