When sending emails meta-data in the email “header” explains who sent the email.
There are two similar, but quite different, details that when not set correctly can make your emails appear as spam to spam filters – leaving your emails in a spam folder or not arrive at all.
These are:
- from – the author of the email
- sender – the address that sent the email
These are explained in more detail in the official RFC standard.
Plugins that send emails, like Gravity Forms, often let you set the ‘from’ address – but not the ‘sender’. Instead they use what WordPress is configured to use – making spam filters see this as a spam message.
The code below shows how to to set the ‘Sender’ address to the ‘From’ address.
If you haven’t already I suggest you create a custom plugin for holding any custom PHP code.
/* Description: Set Sender address using from address Date: 6 January 2018 Author: IT Support Guides Author URL: itsupportguides.com */ class WPDG_Set_Sender_Address_Email { function __construct() { add_action( 'phpmailer_init', array( $this, 'set_sender_address' ) ); } function set_sender_address( $phpmailer ) { $phpmailer->Sender = $phpmailer->From; } } new WPDG_Set_Sender_Address_Email();