Package: msmtp-mta Version: 1.4.24-2 Severity: important Consider the following scenario: msmtp-mta is installed and configured to relay mail to a postfix smarthost at smtp.<local domain>, which accepts it. Thus, cron can demonstrably send mail, e.g. with a job "@hourly echo foo".
Now, suppose there is a backup program that is invoked from /etc/cron.daily. For simplicity, let it be this simple example: #!/bin/sh echo "I had a recoverable error!" sleep 1h Now, what happens is this: 1. cron runs run-parts, which runs the backup script 2. as soon as cron sees some output, it runs msmtp, and provides it with the headers. It leaves the pipe open, because the job hasn't finished and there might be more output. 3. msmtp opens the connection to postfix *as soon as it receives all the headers*, and then leaves that connection open while it waits for the rest of the body. 4. postfix closes the idle connection after less than an hour. The end result is, mail from cron is lost. Here is what syslog reports when this happens: flora msmtp: host=smtp tls=off auth=off from=root recipients=root smtpstatus=421 smtpmsg='421 4.4.2 stomp.cyber.com.au Error: timeout exceeded' errormsg='the server did not accept the mail' exitcode=EX_UNAVAILABLE flora CRON: (root) MAIL (mailed 44 bytes of output but got status 0x0045#012) For now, I am working around it as follows, but this feels like a dirty hack, and it's a pain to have to do it on all my hosts. # dpkg-divert --rename /usr/sbin/sendmail # cat >/usr/sbin/sendmail <<-EOF #!/bin/bash -e ## Workaround long cron jobs being discarded because ## msmtp opens the connection as soon as the headers finish, ## resulting in stomp/postfix timing out the connection. f="`mktemp -t sendmail.XXXXXX`" trap "rm -f \"$f\"" 0 TERM INT QUIT cat >"$f" exec /usr/sbin/sendmail.distrib "$@" <"$f" EOF # chmod +x /usr/sbin/sendmail A better solution, I think, would be to have the option of telling msmtp not to open a connection to the smarthost until it receives an EOF from stdin. I could then set it in my /etc/msmtprc and be happy. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages msmtp-mta depends on: ii msmtp 1.4.24-2 msmtp-mta recommends no packages. msmtp-mta suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org