Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envelope address passed to sendmail #78

Closed
MartinMystikJonas opened this issue Dec 16, 2020 · 3 comments
Closed

Envelope address passed to sendmail #78

MartinMystikJonas opened this issue Dec 16, 2020 · 3 comments

Comments

@MartinMystikJonas
Copy link

MartinMystikJonas commented Dec 16, 2020

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.

@dg
Copy link
Member

dg commented Jan 5, 2021

Can it cause some problems when it will be the default?

@dg dg closed this as completed in 595ef92 Jan 5, 2021
@MartinMystikJonas
Copy link
Author

I think not. At least if you do not use some quite non-standard configuration of mail delivery system. But I am not 100% sure.

@dg
Copy link
Member

dg commented Jan 6, 2021

We will see :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants