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:

which led me to:

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 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:

  1. telnet 25
  2. Trying
  3. Connected to (
  4. Escape character is '^]'.
  5. 220 ESMTP Sendmail 8.13.1/8.13.1; Wed, 28 Feb 2007 04:47:18 -0800
  6. HELO
  7. 250 Hello [], pleased to meet you
  8. MAIL
  9. 250 2.1.0 Sender ok
  10. RCPT

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 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 was no longer responding, or perhaps it never was and I never noticed. To comment out a line in the main file, simply put dnl at the start of the line. This now is what I have in my file:

  1. FEATURE(`dnsbl',`',`"550 Denied RBL " $&{client_addr} " by"')dnl
  2. FEATURE(`dnsbl',`',`"550 Denied RBL " $&{client_addr} " by"')dnl
  3. FEATURE(`dnsbl',`',`"550 Denied RBL " $&{client_addr} " by"')dnl

For those so inclined to mess with the 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 file is found at /usr/lib/opcenter/sendmail/install/

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

  1. m4 /usr/lib/opcenter/sendmail/install/> /etc/mail/

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, 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 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 After removing it from, I checked the other DNSBL’s I was using and found 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 and 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 ;-)