Exim 4.87 emails not being delivered right away

Desai, Jason jason.desai at saabusa.com
Thu Aug 25 02:15:48 UTC 2016

I tried sending this earlier, but I do not see that it made it to the list - resending again ....

I ran into an issue where emails would go through the mail scanner, but they would not be delivered with exim right away.  It would not be until the queue runner process would get to the emails in the out queue that they would finally get delivered.  Running MailScanner in debug mode would show "exim: can't get the current working directory".  Looking at the source code for Exim I saw that it tries to get its current working directory, and fails if there is an error.  (This code was added in version 4.87.)  That made me think that perhaps MailScanner changed to a temporary folder, started Exim to deliver the messages (with sendmail2), and then removed that temporary folder before Exim had a chance to initialize or deliver the emails.

I changed MailScanner to not try to deliver in the background, and the issue went away.  So then I put that back, and updated the Exim.pm code to change to a specific folder before attempting the Exim delivery, and that seemed to fix the issue.  I don't know if MailScanner depends on the working directory not getting changed anywhere - if it does, hopefully someone will let me know.  I am running MailScanner 4.85.2-3.  I did not see any similar change since that version.  Here is the change I made:

--- Exim.pm.old 2015-02-28 12:18:33.000000000 -0500
+++ Exim.pm     2016-08-17 16:39:58.000000000 -0400
@@ -1119,6 +1119,7 @@
     my $idlist = join(' ', @ThisBatch);
     $idlist .= ' &' if MailScanner::Config::Value('deliverinbackground');
     #print STDERR "About to do \"Sendmail2 -Mc $idlist\"\n";
+    chdir MailScanner::Config::Value("incomingworkdir");
     system(MailScanner::Config::Value('sendmail2') . ' -Mc ' . $idlist);

     #JJH # JJH's version

If it is useful, can you please include it in the source?  Thanks.


This message is intended only for the addressee and may contain information that is company confidential or privileged. Any technical data in this message may be exported only in accordance with the U.S. International Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 CFR Parts 730-774). Unauthorized use is strictly prohibited and may be unlawful. If you are not the intended recipient, or the person responsible for delivering to the intended recipient, you should not read, copy, disclose or otherwise use this message. If you have received this email in error, please delete it, and advise the sender immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20160825/332bac1a/attachment.html>

More information about the MailScanner mailing list