Bug #94350

Impossible to add Return-path to email in TYPO3 v. 10

Added by Claus Harup 4 months ago. Updated 9 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2021-06-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

sreen.png (42.5 KB) sreen.png Claus Harup, 2021-06-15 15:22
#1

Updated by Claus Harup 4 months 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

UPDATE: https://stackoverflow.com/questions/26762802/phpmailer-bounced-mails-not-getting-bounced-right/26765956#26765956

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

#2

Updated by Oliver Bartsch 9 days ago

  • Status changed from New to Needs Feedback

Hi, is this issue still relevant?

Also available in: Atom PDF