zendframework/zf2 — pull request #6570 by ameir (2014-08-13 16:44:20+00:00)
Title: Add ability to set SMTP envelope addresses

I am working on a program that is called from a mail server, and re-injects the message back into the mail queue to be sent to multiple recipients (using a Postfix content filter). The problem is that this library forms the RCPT TO: information from the message headers, which in this case, will not work (the goal is for the message to arrive untouched). There should be an option to pass SMTP-level message options to the transport to handle situations like this.

I currently have something like the following:

```
$email = file_get_contents("php://stdin");
$headers = $body = '';
Zend\Mime\Decode::splitMessage($email, $headers, $body);

// Setup SMTP transport
$transport = new Zend\Mail\Transport\Smtp();
$options = new Zend\Mail\Transport\SmtpOptions(
array(
'name' => php_uname('n'),
'host' => '127.0.0.1',
'port' => 10025,
)
);
$transport->setOptions($options);

$message = new Zend\Mail\Message();
$message->setHeaders($headers);
$message->setBody($body);
$transport->send($message);
```

This pull request will allow you to do:

```
$message = new Zend\Mail\Message();
$message->setHeaders($headers);
$message->setBody($body);
$envelope = new Zend\Mail\Transport\Envelope(array(
'from' => 'mail-from@address.com',
'to' => 'rcpt-to@address.com',
)
);
$transport->setEnvelope($envelope);
$transport->send($message);
```