When I send a mail with PHP the destinatary gets a header like this one:
[email protected] **via** de p3nlhg147.shr.prod.phx3.secureserver.net
I want to remove the "via" part. Most automated mails from websites don't have the "via" so it's certainly possible to remove it.
How do they do it?
Yes, you can get rid the "via" part. Here's the details:
1) SPF and DKIM
Firstly, you would need to set an SPF record for the domain you are sending emails from and enable DKIM as well. These are primarily for identifying your messages against spam.
2) "From: [email protected]"
Secondly, make sure you are setting the “From: ” header to be an email address on the domain you are sending messages from. Don’t pretend to be someone else. Use “From: [email protected]” if you are sending the messages from abc.com, rather than anything else, such as [email protected], or [email protected], or whatever. If you want the recipient to reply to your Gmail email instead of your domain email, use the “Reply-To: ” header. “From: ” must always be the domain email that you are sending the email from.
3) "Return-Path: [email protected]"
Thirdly and most importantly, set the “Return-Path: ” header to be the same domain as that of the “From: ” header. Use the 5th parameter of the mail() function for this:
mail('[email protected]', 'Subject', "Message Body", $headers, '[email protected]')
So the Return-Path of this message would be “[email protected]” (the email address immediately following the -f switch). The $headers parameter should contain all the necessary message headers. Make sure “From: ” is [email protected].
After these steps and measures, Gmail should now completely trust your messages from yourdomain.com. The ‘via‘ field of your messages should be gone and the ‘mailed-by‘ field as well as the ‘signed-by‘ field should be correctly showing up as yourdomain.com.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With