zend-mail
zend-mail copied to clipboard
Settings Return-Path Email is not used
- [x] I was not able to find an open or closed issue matching what I'm seeing.
- [x] This is not a question. (Questions should be asked on chat (Signup here) or our forums.)
Return-Path Email is not used because the php function mail($to, $subject, $message, $headers, $parameters) only uses the last forced email from the $parameters string and the method prepareParameters(Mail\Message $message) in the class zend-mail\src\Transport\Sendmail.php adds a second forced parameter, so the mail() function only uses this second parameter and the desired return path email is ignored.
E.g. $parameters = " '-f [email protected]' '-f [email protected]'"; It will use '[email protected]' as return path email.
Code to reproduce the issue
$sender = $message->getSender();
if ($sender instanceof AddressInterface) {
$parameters .= ' -f' . \escapeshellarg($sender->getEmail());
return $parameters;
}
$from = $message->getFrom();
if (count($from)) {
$from->rewind();
$sender = $from->current();
$parameters .= ' -f' . \escapeshellarg($sender->getEmail());
return $parameters;
}
Magento 2.3.0 Alpha: steps to reproduce
1 - Admin store: Stores > Settings > Configuration > Advanced > System > Mail Sending Settings > Return-Path Email - set a different return path email
2 - Place an order
3 - Look for ´Return-Path:
Expected results
return path email saved in settings
Actual results
sender or from email
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/26.