Php mail function

I use PHP to send email with the following headers:

From: danny@mydomain.com To: dannyfriend@gmail.com 

When I check the headers in the dannyfriend@gmail.com (recipient) mail client, I see this header:

 Received: from admin by gator1815.hostgator.com with local (Exim 4.69) (envelope-from < danny@mydomain.com >) 

But sometimes mail is sent to the dannyfriend spam folder because the message is sent through hostgator.com not through mydomain.com, as to the sender's email address.

What is really going on here? Why is this not so:

  Received: from admin by somename.mydomain.com with local (Exim 4.69) (envelope-from < danny@mydomain.com >) 

I saw an article describing this problem. Can someone highlight what is happening with the SMTP server?

Summary: Why does the SMTP server not use the message from the FROM: header as an envelope from?

+4
source share
1 answer

In fact, you are using an anonymous smtp relay. Your ISP, the host server, in this case, will probably send an email on behalf of the email address you are using. You may need to qualify your server as a valid SMTP server that can receive and send emails. If the header does not correspond to reality from the domain, the mail client or the receiving party suspect that it comes from a fraudulent address and marks it as spam.

0
source

Source: https://habr.com/ru/post/1395014/


All Articles