Skip to content

Envelope address passed to sendmail #78

Description

@MartinMystikJonas

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions