Getting weird exception with Zend_Mail and Postfix - php

I run three Magento web stores. All the orders e-mails are working just fine, with the exception of 7 e-mails that didn't even got sent from the webserver. Upon investigating the issue I discovered the following logs:
Magento log:
2013-08-08T11:44:59+00:00 ERR (3):
exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. ' in /var/www/website.com/lib/Zend/Mail/Transport/Sendmail.php:137
Postifx log:
Aug 8 12:44:59 bv-webserver postfix/sendmail[18647]: fatal: sales#website.com(33): No recipient addresses found in message header
Aug 8 12:44:59 bv-webserver postfix/postdrop[18648]: fatal: uid=33: malformed input
This is very strange, because hundreds of e-mails were sent just fine and only these 7 got this exception. In some cases the clients just purchased again from the store and then received the e-mail as expected.
I thought it could be a resource problem. But I run the newrelic agent and the server is at 20% load at most during peak hours (both memory and processors).
Edit: Forgot to mention, I run nginx with php-fpm.

You'll always have an issue if you try to send emails without a recipient address. Postfix is telling you:
8 12:44:59 bv-webserver postfix/sendmail[18647]: fatal: sales#website.com(33): No recipient addresses found in message header
Fix that and you should be Ok.
You might need to look into why the application apparently lost the email addresses for the seven transactions in question.

Related

Command died with status 255 5.3.0- Email to SMS

I receive the following error when trying send emails via a distribution list e.g email to SMS:
This is the mail system at host email-to-sms-0x.xxx.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
(expanded from
<7afc3e8f8de82#dist.test.com>): Command died with status
255: "/etc/mail/XXX.php". Command output: _
Final-Recipient: rfc822; dist-TEST-com#email-to-sms-02.test.com
Original-Recipient: rfc811;7afc3e8f8de82#dist.test.com
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; _
The server uses postfix and I am unsure on how to proceed.
Would this be due to a php cronjob not executing or the permissions being incorrect?
Any help would be appreciated.
This is a Centos OS.
I have change some of the output to protect data.
Kind Regards
Ali G
You need to check the mail.log on email-to-sms-0x.xxx.com -- since Postfix doesn't disclose all information it obtained in the bounce.
It's probably a permission issue, yes :)

Swiftmailer raise an exception with code 554, client host rejected

I'm using Swiftmailer to send mail through a contact form with Symfony. My ISP allows me to send mail from a remote server with my mail account information (username, password and smtp).
My problem is that when I'm sending a mail from my development site (from my desktop server) I can do it and the mail is sent, but in the production environment Swiftmailer raise an exception saying that the client host is rejected (code 554 5.7.1) and failed to send the mail. I have tried to debug this with the app/console swiftmailer:email:send and I get the same error :
Exception occurred while flushing email queue:
Expected response code 220 but got code "554",
with message "554 5.7.1 <unknown[here-example-ipv6]:49545>:
Client host rejected: Access denied " [] []
The ipv6 (here-example-ipv6) is corresponding to a dns of my host that I have not configured, but I don't understand why Swiftmailer believes that this ip is corresponding to the client host, my configuration seems (app/config/config.yml and parameters.yml) to be good because that's work fine from my desktop. Any help would be appreciated, thank.
Ok, I get it. I was confused with the error message because I thought it was comming from Switmailler, but it was comming from my ISP mail server.
The problem was that when you want to send a mail from a remote location my ISP require to activate SSL encryption.
So I have added two more parameters for the Swfitmailler configuration :
port: 465
encryption: ssl
and now that's fine. But because I was testing from a production environment, the cache has to be cleared in order the changes to take effect.

SMTP Error Issue - PHPMailer

I have a daily newsletter I send out to a list of people each day. I use PHP and the PHPMailer object to send the emails.
This has been working fine up until today when I didn't get an email (test) and I checked the logs to find that intermittently I was getting SMTP errors back from
mail->Send();
Method of the class on SOME of the people - not all of them.
All of the emails were exactly the same size (length in characters) apart from their name and email address.
The error details from
$mail->ErrorInfo;
Included these two errors
SMTP Error: Data not accepted.<p>SMTP server error: 2.1.5 Ok
SMTP Error: Data not accepted.<p&gtSMTP server error: </p>
Why there are broken P tags in the error message I have no idea - also why the first error has OK in it??
However other people in the loop had emails go out fine.
Also when I put the script into test mode so ONLY these failures were emailed out (so one call of the script = one email to one person), I found no problem and the people got their emaail.
Now I asked tech support what the error meant and got back "Google it" and I can't find the error 2.1.5 OK anywhere. I don't really get why it says OK after an error either.
As a test for tomorrow I put a test in for a failed Send and then a Sleep for 5 seconds with a retry.
I don't know if this will help but I thought that maybe my SMTP server which is on the same server as my script (Rackspace VPS Linux) was having temporary issues connecting so a sleep might be handy in this situation.
This is the first time I have had this issue, I haven't rebooted APACHE or my server (or mailserver) and before this script I had another one send out 403 emails without any problem.
It would be nice to know what the error is and why it happened though.
Rob
That error is defined exactly where you would expect it to be - in the RFC that defines SMTP error codes. 2.1.5 means "Destination address valid". That it starts with a 2 means it's not an error as such, but a response code - warnings and errors start with 4 and 5. Why you got it, I don't know, but it certainly seems it was not expected in that context. Mail servers often have problems - they run out of disk space, get swamped by spam filtering, and this is why mail servers have queues. Sending directly using PHPMailer's SMTP class is not appropriate for high-volume sending - using SMTP is fine, but point it at a proper (nearby) MTA that can handle deliveries properly.
As for the garbled ErrorInfo content, I suspect you are using an old version of PHPMailer - the debug output has been cleaned up fairly recently. Another thing that changed lately is the handling of errors during single sends to multiple recipients (e.g. BCCs) - it's now much more likely to get to the end of a long recipient list without giving up than it was before.

Moodle New User Email Confirmation Error - Tried to send you an email but failed

Whenever a new user tries to create a new account, they get this message
Tried to send you an email but failed!
I tried setting up an email and using the smtp settings in Site
Administration -> Message output -> Email and that did not work.
I called my Host company (inmotion hosting) and they verified that my
settings were correct.
I tried just leaving the settings blank in email so that the phpmailer would send the emails, but that is not working and I still get the same message.
I have searched all overand I cannot find any helpful information on why this is happening,
but I find A LOT of people who are having this issue.
This has turned into a MAJOR show stopper and I am wondering what avenues I have to troubleshoot this. Does anyone have any information on how this is fixed?
Thanks in advance.
It might be missing a "from" email - have you got a support email set up?
/admin/settings.php?section=supportcontact
Or go to Site Administration > Server -> Support contact
I've had a similar issue. It works fine for the first three users created (in quick succession) but then fails for a few minutes. Enabling debugging (Site Admin -> Development -> Debugging page) showed that this was due to timeouts:
Debug info:
Error code: auth_emailnoemail
Stack trace:
line 463 of /lib/setuplib.php: moodle_exception thrown
line 106 of /auth/email/auth.php: call to print_error()
line 70 of /login/signup.php: call to auth_plugin_email->user_signup()
Output buffer: profile_field_PC<pre> SMTP -> ERROR: Failed to connect to server: Connection timed out (110)SMTP connect() failed. </pre>
This appears to be an anti-spam "feature" of the Amazon SES service we were using, which we will need to get around.
I know this is an old post but I will add my solution and give many thanks to Russell for that part of it.
This site had been moved over to Bluehost and come to discover that client did not set up an email account for Admin User - so in addition to checking that there is an email in the Admin settings, also verify that that email address exists and is reachable!

Warning: mail(): SMTP server response: 451 spamhaus-xbl - Blocked

Here I am trying to send email from my local machine.At that time I have got this warning.
Warning: mail(): SMTP server response: 451 spamhaus-xbl - Blocked -
121.246.216.118 in C:\wamp\www\OpenInviter\example.php on line 117
I have got this error when I am adding the bellow code at top in my example.php file.
ini_set("SMTP","mail.domain.com");
ini_set("smtp_port","25");
ini_set('sendmail_from', 'Email#domain.com');
Example.php
foreach ($selected_contacts as $email=>$name)
mail($email,$message_subject,$message_body,$headers);
$oks['mails']="Mails sent successfully";
What's the problem?
Spamhaus is blocking your IP as its listed # http://cbl.abuseat.org - The reason is that you may have a virus, trojan on your computer, or possibly infected with a proxy for a spamming botnet, not good.
Once you have made sure that all the systems that use the IP are not infected visit: http://cbl.abuseat.org/lookup.cgi?ip=121.246.216.118 and click the link at the bottom. You will perhaps have to wait a week/month before all the block lists purge your ip.
If you have recently acquired the IP from your service provider, get in touch with them and ask that they change your IP.
Good luck.
Your IP has, correctly or incorrectly, been deemed a source of spam and the SMTP server is not accepting email from you. Try a different SMTP server with which you properly authenticate, possibly a paid-for service, or try to get yourself delisted at spamhaus (good luck with that).

Categories