zendframework / zend-mail

Mail component from Zend Framework
BSD 3-Clause "New" or "Revised" License
96 stars 111 forks source link

Settings Return-Path Email is not used #216

Open Filipe-Bicho opened 6 years ago

Filipe-Bicho commented 6 years ago

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 test1@mail.com' '-f test2@mail.com'"; It will use 'test2@mail.com' 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: ' in the email

Expected results

return path email saved in settings

Actual results

sender or from email

weierophinney commented 4 years ago

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.