I am using the php mail function to send emails. I pass in the to address and I also build out some additional email headers, including From: and Reply-To:.
However until now I have also been including a To: header in the additional headers. For eg i would pass email "user@email.com" to the mail function but in addition I will be including a to header below as part of the header.
"To:Users Name <user@email.com>"
The result is that php mail includes a To: header TWICE in the email, once with the email address (as passed into the first param of the function) and the other as part of the header param passed to php mail.
TO: user@email.com
TO: Users Name <user@email.com>
As a result it is getting blocked by some spam systems.
So have a few questions:
is there any real benefit including a full To: header which has the recipients name and email as opposed to just having a TO: header of "user@gmail.com" without the recipients name.
Is there any reason not to just pass the full to header (ie name & email) into the first param of the mail function and just leave it out of the additional header param.
Looking for the right approach here. Thanks