Sendmail and all other properly written MTAs are written so that there are are only two possibilities:
- the message is first written to disk and then acknowledged to the sending MTA
- the message is not acknowledged
With this method, there are three outcomes in case an error occurs:
- The error occurs before the receiving sendmail has tried to acknowledge it. The sending party retries.
- The error occurs after the receiving sendmail has tried to acknowledge it, but before the sending party receives the acknowledgement. This basically happens if the acknowledgement packet is lost on the network. The sending party retries but the receiving party will process the mail. The message will be duplicated.
- The error occurs after the sending party receives the acknowledgement. The receiving party has the responsibility for processing the mail correctly.
The failure mode is therefore "fail-safe": if the sending party cannot determine whether responsibility for the message has been successfully transferred to the receiving party, then it will send again, even though this may result in the duplication of the mail in the recipient's inbox.
The only case in which a message can be lost is if there is a severe failure on the server (disk failure or permanent loss of the machine) while it has responsibility for the mail.
I have just now tested on sendmail 8.14.9, and when I do an /etc/init.d/sendmail stop, which on this machine is implemented by killall ${SENDMAIL_HOME}/bin/sendmail
, which sends the kill -15
you are asking about, the mails currently incoming in DATA phase are aborted. The TCP session is closed by the server.
On this machine, restart
is implemented by stop ; start
, so the answer to your question is that no, the restart is not graceful, but (of course) no mails will be lost as long as they are being sent by or to an RFC-compliant implementation of SMTP.
This sounds like it could never happen, but (say) PHP or Java applications using some SMTP mail library to send to their smarthost will receive an error, and it is then up to that application to send the mail again. Spoiler alert: they usually don't, but the effect is the same as if the mail server was already shut down when they tried to send.