Docker PHP / Apache Container – Sendmail 553 Error “Domain of Sender Address does not exist” when trying to send mail
I’m having trouble sending e-mail on my PHP/Apache docker container via sendmail. I’m wondering if someone has a simple, straight forward solution. I am not a systems/server expert by any far stretch and my smtp/sendmail expertise is equally underwhelming. Thanks in advance for the help.
Below is the error I’m recieiving:
sendmail: 553 5.1.8 <apache@a0aca7313106>... Domain of sender address apache@a0aca7313106 does not exist
Clearly apache is my user, and that stuff to the right is my docker container ID. There is a “From:” header value within the pHp Mail parameters being passed, so not sure why it’s defaulting to this.
As requested by the comment below, I am adding the “mail” function that is being used. I can confirm there is data within this function, specifically the “$this->headers” which contains a From address.
It should be noticed that I am running the exact same code in a non-containerized environment, and the e-mail gets sent fine so I believe it’s a container configuration issue. These are the areas of the php.ini that I have modified. Is there something else I should be looking for?
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25
I changed “localhost” to the smtp server listed on my non-containerized environment, restarted apache in the container, but still recieved the error message above.
I am able to connect to my external SMTP server via telnet using the reference listed in the comments below (thanks @mark91). This is my output/transcript. I should mention that my e-mail was never actually received, however (I listed myself as the recipient). I masked the info with *******’s
telnet smtp.service.******* 25 Trying *******... Connected to *******. Escape character is '^]'. 220 ******* ESMTP smtp.service Fri, 31 Oct 2014 14:29:16 -0400 HELO ******* 250 ******* Hello [*******], pleased to meet you MAIL FROM: ******* 250 2.1.0 *******... Sender ok RCPT TO: ******* 250 2.1.5 *******... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Hello . 250 2.0.0 s9VITGpm030795 Message accepted for delivery
One Solution collect form web for “Docker PHP / Apache Container – Sendmail 553 Error “Domain of Sender Address does not exist” when trying to send mail”
How are you sending this e-mail in PHP? At least, you might configure correctly your php.ini file in order to put as smtp server the right value. Moreover, if you are using the PHP mail function, you should put as $header parameter a string containing “From: email@example.com\r\n”…