• Setting the last parameter of PHPMailer::setFrom() to false stops PHPMailer setting the Sender/envelope/RFC5321.FROM header so that it matches the mail From header.

    This often will cause a situation where an email is sent from php-fpm@hostname or similar. For best deliverability, the envelope sender should match the mail from address.

    Although this can be set in PHP configuration with the -f parameter to sendmail, I’m curious why wp_mail explicitly prevents it from being set?

    Reference

    Jamie

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    If you want to set the -f Sendmail parameter, hook phpmailer_init and set $phpmailer->Sender to the email address you want for Return-Path.

    Please note that use of the -f parameter requires the username that’s running PHP to be defined as a “trusted user” in your MTA (Exim/Postfix/etc).

    Thread Starter jamieburchell

    (@jamieburchell)

    I’m curious as to why this isn’t the default behaviour though? I’d argue that it rarely makes sense to have the sender as the user PHP is running as at the server’s hostname which is also going to most likely be different to what the mail from is.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Setting the RFC5321.FROM/envelope sender in PHPMailer::setFrom()’ is closed to new replies.