Email showing "via hosted35.nfoservers.com"

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
marka2049
New to forums
New to forums
Posts: 3
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Jun 22, 2020 2:30 am

Email showing "via hosted35.nfoservers.com"

Post by marka2049 »

Im sure we're all familiar with this. When sending an email from php to gmail, it will append "via hosted35.nfoservers.com" as an anti-spoofing measure.

I have done some searching on gmail/google's own information and the forums here. I found this post about adding an SPF record. I did this.

Sending e-mails still shows the "via ..." text. Are there any other steps that can be taken to "prove" these emails sent by my script are legitimate? Is there a way to login to my actual email account via script and send that way (if such a thing would even work)?

Thanks
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: Email showing "via hosted35.nfoservers.com"

Post by Spray »

As long as you have an SPF record setup correctly, you should just need to set the correct headers for the PHP mail function, which will have Gmail strip off the "via" tag. Most importantly, you'll want to ensure your From and Return Path headers are set.

Try the following setup for your mail function:

Code: Select all

$headers = "From: email@domain.com";
$headers .= "\r\nReply-To: email@domain.com";
mail('email@gmail.com', 'Test message subject', 'Test message', $headers,'-freturn@domain.com');
marka2049
New to forums
New to forums
Posts: 3
Joined: Mon Jun 22, 2020 2:30 am

Re: Email showing "via hosted35.nfoservers.com"

Post by marka2049 »

Spray wrote: Mon Jun 22, 2020 6:09 am Most importantly, you'll want to ensure your From and Return Path headers are set.
Ah, yes. That did the trick. In particular, the -f flag in the additional parameters for the mail function is what got rid of the "via" tag.

Thank you!
Post Reply