@ Stephen
RE: I would like to change the “sent from”and the “reply to” fields so that the emails don’t register as suspicious
I’m guessing you mean in Gmail, correct? Simple solution, don’t send an email to yourself. When the from and to are the same, Gmail will flag that. Second, you should setup your site to use an email host provider. I personally use SendGrid. When properly setup the emails will be signed which mean it will be far less likely to be flagged as spam and marked suspicious (unless you send to yourself ;) )
RE: but allow recipients to reply directly to the sender.
This is already how Contact functions. The from/reply to address is from the sender and sent to is the email address of the entry the email is being sent to.
RE: set reply to
This code will not work:
//Set reply to.
$email->reply(
sanitize_email( $_POST['email'] ),
sanitize_text_field( $_POST['name'] )
);
The reason is because there is not reply() function. Since the Connections email class is simply a wrapper for the core WordPress wp_mail() function you would setup the reply to address similarly. Not tested…
$email->header( ‘Reply-To: Person Name person.name@example.com‘ );
Of course you would need to change the above to populate with the variables. But there is no need because the reply to address will default to the from address.
Hope this helps!
