We just encountered increasing undelivered messages rate on certain recipient server and it was caused by mismatch between From header and envelope address. Then we found out that Nette did not pass required parameter (-f) to sendmail automatically and it must be set manually. I would expect this would be handled by mailer.
We solved it by replacing default SendmailMailer by this child class:
class SendmailMailer extends \Nette\Mail\SendmailMailer {
public function send(Message $mail)
{
$from = array_keys($mail->getFrom());
if($from) {
$this->commandArgs = "-f".reset($from);
}
parent::send($mail);
$this->commandArgs = null;
}
}
I just think this should either be default behaviour (is the any case when yo do not want to pass -f parameter?) or be configurable either by providing subclass (EnvelopeSendmailMailer, FromSendmailMailer, ...) as we did it or even better maybe as option (setPassEnvelopeFrom()) of SendmailMailer.
We just encountered increasing undelivered messages rate on certain recipient server and it was caused by mismatch between
Fromheader and envelope address. Then we found out that Nette did not pass required parameter (-f) to sendmail automatically and it must be set manually. I would expect this would be handled by mailer.We solved it by replacing default
SendmailMailerby this child class:I just think this should either be default behaviour (is the any case when yo do not want to pass -f parameter?) or be configurable either by providing subclass (
EnvelopeSendmailMailer,FromSendmailMailer, ...) as we did it or even better maybe as option (setPassEnvelopeFrom()) ofSendmailMailer.