I am trying to set my headers for use with the mail function. Unfortunately, setting the "From" header does nothing, as I don't get the email address and name I want displayed.
A previous post concerning the same topic was made when someone was trying to set the "From" field in their mail headers. Another person replied as follows:
The truth is the From: header is not used to send the Return to Sender message. After the mail function has been used and before the message is sent, PHP uses the email address in the sendmail_from = directive of your PHP.ini file when sending the message.
When PHP connects to the SMTP server it sends the line: MAIL FROM: sendmail_from. It is then that the SMTP server sets the Return-Path: header in the email to the address used in mail from. Unfortunatly you cannot set the return path header in the mail function, as it would just be over written by the SMTP server. The only way to do it is to either change the sendmail_from directive or have your PHP script manually send the mail by connecting to the SMTP server by its self.
My question is, how do I get my PHP script to manually send the mail by connecting to the SMTP server by itself? I thought that calling the mail function was doing that in itself.
Have I given enough information to get the question answered?