savemail panic in sendmail

"savemail panics" occur when sendmail is unable to deliver a bounced message to the postmaster alias. After being unable to deliver a message for 5 days (by default), sendmail will bounce email to the postmaster alias.

If this alias is not properly configured, sendmail will have a savemail panic: it will not attempt future delivery of the message, but the message remains in the mail queue directory for examination by the system administrator. sendmail renames the header of the queued message from qf* to Qf*, making it easy to identify these messages in your mail queue. These "lost" messages may also be identified with the mailq -qL command (thanks to Jonathan Kop for introducing me to this command).

To diagnose the cause of a savemail panic, first make sure you have the following entries in /etc/aliases:

# Basic system aliases -- these MUST be present
MAILER-DAEMON:    postmaster
postmaster:    root

If these entries are present, try running sendmail -bv MAILER-DAEMON and sendmail -bv postmaster. If these commands hang, rebuild the aliases database with by running newaliases or sendmail -bi.

If you still experience savemail panics, gather one or more "lost" message IDs with mailq -qL, rename the appropriate Qf* file to qf*, and execute the following command (thanks to Jonathan Kop for providing this troubleshooting step):
sendmail -v -qImessage_ID -d11

Example sendmail syslog error messages:

Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE3004499: Losing q5/qfg9N5EwE3004499: savemail panic
Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE3004499: SYSERR(root): savemail: cannot save rejected email anywhere

Oct 24 04:18:57 host sm-mta[4499]: g9J7o0Ds022688: to=postmaster, delay=5+01:28:57, mailer=local, pri=8490691, dsn=5.1.1, stat=User unknown
Oct 24 04:18:57 host sm-mta[4499]: g9J7o0Ds022688: g9N5EwE5004499: postmaster notify: User unknown
Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE5004499: to=MAILER-DAEMON, delay=00:00:00, mailer=local, pri=9851, dsn=5.1.1, stat=User unknown
Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE5004499: to=postmaster, delay=00:00:00, mailer=local, pri=9851, dsn=5.1.1, stat=User unknown
Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE5004499: g9N5EwE6004499: return to sender: User unknown
Oct 24 04:18:57 host sm-mta[4499]: g9N5EwE6004499: to=MAILER-DAEMON, delay=00:00:00, mailer=local, pri=10875, dsn=5.1.1, stat=User unknown

After you have fixed the savemail panic problem, you will want to examine, move, or delete messages that have been preserved by sendmail as a result of a savemail panic.

The following commands will delete messages preserved by a savemail panic (using multiple mail queues):

for queue_dir in q1 q2 q3 q4 q5
do
   cd /var/spool/mqueue/$queue_dir
   for i in `ls Qf* | cut -c3-`
   do
      rm *$i
   done
done

The following commands will delete messages preserved by a savemail panic (using a single mail queue):

cd /var/spool/mqueue/$queue_dir
for i in `ls Qf* | cut -c3-`
do
   rm *$i
done

Back to brandonhutchinson.com.

Last modified: 2007/04/23