SMTP From Name being ignored

Today I have been alerted to a problem where the notification emails sent by Gravity Forms are being sent with the wrong From address. The major issue is that the client uses Office365 HVE for SMTP, and hence the wrong domain in the From address means that all notification emails are being rejected by their SMTP server.

We have been using the following code for the last 6 months in our functions.php:

function smtp_details( $phpmailer ) {

$phpmailer->isSMTP();

$phpmailer->Host       = SMTP_HOST; // phpcs:ignore

$phpmailer->Port       = SMTP_PORT; // phpcs:ignore

$phpmailer->SMTPSecure = SMTP_SECURE; // phpcs:ignore

$phpmailer->SMTPAuth   = SMTP_AUTH; // phpcs:ignore

$phpmailer->Username   = SMTP_USER; // phpcs:ignore

$phpmailer->Password   = SMTP_PASS; // phpcs:ignore

$phpmailer->From       = SMTP_FROM; // phpcs:ignore

$phpmailer->FromName   = SMTP_NAME; // phpcs:ignore

}

add_action( ‘phpmailer_init’, ‘smtp_details’ );

In our wp-config.php we have the following, along with all the SMTP server constants shown above:

define( ‘SMTP_FROM’, ‘website@domain.com’ );

define( ‘SMTP_NAME’, ‘From Name’ );

This should override the From address set in Gravity Forms, which was the site’s admin email with a different domain. This has been working in the past but is suddenly no longer working.

Has anyone else experienced the problem with the From name being set in phpmailer is suddenly not be used anymore?

Have you updated to WordPress 6.9? It includes a change to how the From is handled, which is breaking email delivery on a lot of hosts, they are currently investigating how to resolve it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.