Friday, December 4, 2009

Sendmail ‘collect: premature EOM: unexpected close’ solution

SkyHi @ Friday, December 04, 2009

Sendmail ‘collect: premature EOM: unexpected close’ solution

Posted by plattapuss on February 28th, 2007

If you are getting a 'collect: premature EOM: unexpected close' in your mail logs, or if you have people complaining that they cannot send email to your server and you have this error, then I might have a solution to your problem.

To solve this error I found this link by searching in Google:
http://www.sendmail.org/faq/section3.html#3.10

which led me to:
http://www.sendmail.org/faq/section3.html#3.12

Now although the exact answer wasn't in there, the line about define(`confTO_IDENT',`0s')dnl made me think that I have an issue in my sendmail.cf file. So next I checked one of my domains with the great service DNS Stuff. DNS Stuff apparently could not connect to my mail server either, and told me the last communication with the mail server was RCPT TO:.

To verify this I openen a telnet session from one of my servers to my troubled server on port 25 (SMTP). Here is the session that took place:

CODE:
  1. telnet secure.brokensmtp.org 25
  2. Trying 123.123.123.123...
  3. Connected to secure.brokensmtp.org (123.123.123.123).
  4. Escape character is '^]'.
  5. 220 secure.brokensmtp.org ESMTP Sendmail 8.13.1/8.13.1; Wed, 28 Feb 2007 04:47:18 -0800
  6. HELO secure.workingserver.org
  7. 250 secure.brokensmtp.org Hello server5.outofcontrol.ca [123.123.123.254], pleased to meet you
  8. MAIL FROM:james@workingserver.org
  9. 250 2.1.0 james@workingserver.org... Sender ok
  10. RCPT TO:webmaster@workingserver.org

After the last line RCPT TO: my session hung for almost two minutes. So it was obvious that my sendmail service was really really slow. After a good nights sleep it dawned on me that I had over time installed several Black List denies in my sendmail.cf config file, and that perhaps one of these was not responding anymore.

By commenting out each Black List deny one at a time, I quickly discovered that relays.ordb.org was no longer responding, or perhaps it never was and I never noticed. To comment out a line in the main sendmail.mc file, simply put dnl at the start of the line. This now is what I have in my sendmail.mc file:

CODE:
  1. FEATURE(`dnsbl',`list.dsbl.org',`"550 Denied RBL " $&{client_addr} " by list.dsbl.org"')dnl
  2. FEATURE(`dnsbl',`sbl-xbl.spamhaus.org',`"550 Denied RBL " $&{client_addr} " by sbl-xbl.spamhaus.org"')dnl
  3. FEATURE(`dnsbl',`dnsbl.njabl.org',`"550 Denied RBL " $&{client_addr} " by dnsbl.njabl.org"')dnl

For those so inclined to mess with the sendmail.mc file, please make a backup first. This file must be errors free, or your mailer server will cease to serve. On the RHEL4 Ensim box I am on, the mail sendmail.mc file is found at /usr/lib/opcenter/sendmail/install/sendmail.mc

Once you have made changes to it, you must use m4, a macro processor, to build a new sendmail.cf file. So before doing that, please backup your good /etc/mail/sendmail.cf file. Then run the command:

CODE:
  1. m4 /usr/lib/opcenter/sendmail/install/sendmail.mc> /etc/mail/sendmail.cf

m4 will not ask you to verify if it needs to overwrite an existing file, so once you run that command it's done. Then simply restart sendmail.

There has been a fair amount of talk lately about the 'premature EOM' error over at forums.theplanet.com, and I have posted my solution there as well. A special thanks to pblinux Catalyst over at the planet forums for helping everyone get these Black Lists working in the first place.



Reader Comments

Thanks, I had the same problem and solved it using your explanation ;)

I noticed a few ‘premature EOM’ messages in our sendmail log, and found a couple of rbl sites had gone away. I don’t know yet if this fixes the issue, but your blog was quite helpful

THe RBL antispam.or.id is unavailable since 2007-07-12. Thanks to your post, I find quickly what was going on and I removed it from my black list server.

In the future, I plan to monitor the DNS response of the RBL regulary, using the free monitoring system we use already: Hobbit Monitor

Thak you very much! I also encountered the same error message in my sendmail log files, but didn’t know what was causing it. I was also using relays.ordb.org. After removing it from sendmail.mc, I checked the other DNSBL’s I was using and found opm.blitzed.org is also no longer functioning as a DNSBL.

I’ve posted details on what I found at Premature EOM in Sendmail Log File and information on how to use the nslookup, host, or dig commands to verify that a DNSBL is still functioning.

Thanks again, for your posting. You saved me an enormous amount of time.

Thank you *so* much! I had a brain freeze today when I had been seeing these “collect” errors in sendmail, and didn’t even consider dnsrbl dead entries. Turns out dnsrbl.net and completewhois.com were both dead. Ouch.

I’ve written a bash script & cron job to run hourly, querying the remaining lists, and it will email me if it gets an error response ;-)