From Address set wrongly - need help please
When I send an email from a PHP script in example.com (without using SMTP auth), the from Address is set as cpaneluser@host.example.com. The server name is host.example.com.
However, we want to set the From address as noreply@example.com (as specified in the PHP script).
How to achieve this? I assume we have to set some parameters in Exim Configuration manager.
Please help.
-
I appreciate your response. However, we have been sending mails like this for along time now. This got changed after the recent CPANEL reinstall and I cannot recall the settings I had used. 0 -
Thanks. I will check. 0 -
Once the email is authenticated, it will send as the expected user. This means you will likely need to create the "noreply" address as an email account with a password.
Are you sure about that? SMTP Authentication doesn't have any role in the actual structure of the SMTP transaction. SMTP Authentication is just a means to say "this person has access to send out mail through this server." The key part is to added a "From" header in the 4th parameter of the mail() function in PHP. Additionally, you would want to consider adding a proper envelope-sender using the 5th parameter of the mail() function, so SMTP MTAs will see the appropriate sending address. [plain]mail("recipient@example.tld", "Subject", "Message", "From: from@address.com", "-fenvelopsenderaddress@address.com");[/plain] Using something like PHPMailer will (probably) initiate an actual SMTP transaction with the localhost server, which will then add all of these headers appropriately. But still the information you use to authenticate with the SMTP server doesn't really have to relate to the information that is included in the SMTP transaction. The mail() function will send a mail directly through the sendmail binary. This doesn't require authentication because you're depending on the sendmail binary to send the mail, and you're already on that server. The PHPMailer class (I believe by default) opens an actual SMTP connection (typically with the localhost) to send the mail. Additionally, the term "authentication" here is different from the term "authenticity". Authentication used in this context is meant to authorize access to be able to send out mail. Authenticity - referring to SPF, DKIM, DMARC - is a means for remote servers to verify whether or not the server sending the message should be authorized to be sending mail from the domain (whether the domain being referred to is the domain in the header From or the Envelope-sender is typically a cause for debate and ambiguity).0 -
We are using PHPmailer. We set the from name and address correctly as noreply@domain.com. However, the outgoing mails have this replaced by cpaneluser@servername.com. This used to work fine till we had to re-install the server and I forgot the required setting. 0 -
I resolved the problem partly by adding nobody as a trusted user. I am aware that PHP scripts can now put any from address and will deal with this separately. Now, my server's mails (sent by PHP programs) are reported as nobody@domain.com via severname.com. How to remove this via thing? 0 -
It sounds like the script isn't specifying the From address - is that the case? 0 -
No. We are setting the From name and address properly. The PHP scripts are run by 'nobody' user who was not a trusted user. I added this to the trusted user list. Next, we need to remove the via server.com thing. How? 0 -
Are you running PHP as an Apache DSO module? I didn't know that that was still a thing. 0 -
No. suphp 0
Please sign in to leave a comment.
Comments
11 comments