I consider, you already know how to configure your qmail for working together with maildirsmtp and serialmail. Basically, everything works fine for you, if you execute the maildirsmtp-command on your shell. But when moving the command to your crontab, the delivery of mails fail.
First what you should do is, to put absolute pathes in your crontab, since the cron-daemon does not respect systemwide pathes. Specify full paths in your crontab – anytime, everywhere!
So you crontab looks now something like this:
* * * * * /usr/local/bin/maildirsmtp /path/to/Maildir <remove-delivery-> 1.2.3.4 mail.host.net
Now you should enable logging for debugging:
* * * * * /usr/local/bin/maildirsmtp /path/to/Maildir <remove-delivery-> 1.2.3.4 mail.host.net 2>&1| /var/qmail/bin/splogger serialmail
Adding this will give you the result of the command in your system-logfile (in my case it is /var/log/maillog). There you will now find the following error-message:
Jul 10 11:45:00 mxhost serialmail: 1247219100.556374 maildirserial: fatal: unable to run tcpclient: file does not exist
Jul 10 11:45:00 mxhost serialmail: 1247219100.557665 maildirserial: fatal: unable to run tcpclient: file does not exist
Jul 10 11:45:00 mxhost serialmail: 1247219100.558582 maildirserial: fatal: unable to run tcpclient: file does not exist
Jul 10 11:45:00 mxhost serialmail: 1247219100.558801 maildirserial: fatal: making no progress, giving up
The problem is, that maildirsmtp does not find tcpclient, which is needed for the SMTP-connection. So open your maildirsmtp-script and add the following change (printed in bold):
#!/bin/sh
# WARNING: This file was auto-generated. Do not edit!exec \
/usr/local/bin/maildirserial -b -t 1209600 — “$1″ “$2″ \
/usr/local/bin/tcpclient -RHl0 — “$3″ 25 \
/usr/local/bin/serialsmtp “$2″ “$4″
After this little change, running maildirsmtp from your crontab will work. Keep an eye on updates of your qmail. Since the script is autogenerated, this little change could be removed which will lead your crondaemon to fail again.