Sometimes delivery fails, often with the generic error message ‘Sending failed; SMTP protocol error’. Enabling one or both of the following variables and inspecting a trace buffer will often give clues to the reason for the error.
smtpmail-debug-infocontrols whether to print the SMTP protocol exchange in the minibuffer, and retain the entire exchange in a buffer ‘*trace of SMTP session to server*’, where server is the name of the mail server to which you send mail.
smtpmail-debug-verbcontrols whether to send the
VERBtoken to the server. The
VERBserver instructs the server to be more verbose, and often also to attempt final delivery while your SMTP session is still running. It is usually only useful together with
smtpmail-debug-info. Note that this may cause mail delivery to take considerable time if the final destination cannot accept mail.