Software⏱️ 3 min read📅 2026-06-19

How to Fix: "SMTP protocol error" when sending mail in emacs

Emacs SMTP configuration issue with authentication and encryption settings.

Quick Answer: Check if the server allows relaying after authentication and ensure correct encryption settings.

The 'SMTP protocol error' issue in Emacs occurs when attempting to send mail through an SMTP server. This error is frustrating as it prevents users from sending emails, which can be critical for both personal and professional communication.

To resolve this issue, we need to identify the root cause of the problem and apply the appropriate fix.

🔍 Why This Happens

  • The primary reason for this error is that the server requires authentication before allowing relaying. The Emacs configuration has been set up incorrectly, leading to a denied relay message.
  • An alternative reason could be the incorrect use of 'smtpmail-stream-type' as 'ssl', which may not support TLS encryption. However, according to the Emacs documentation, both 'ssl' and 'tls' can be used for encryption.

🔧 Proven Troubleshooting Steps

Correcting the authentication configuration

  1. Step 1: Update the .authinfo file to include the correct port number (587) and ensure that the login credentials are accurate.
  2. Step 2: Verify that the SMTP server allows relaying after authentication by checking with the server administrator.
  3. Step 3: Apply the changes and retry sending mail using Emacs.

Correcting the encryption configuration

  1. Step 1: Update the smtpmail-stream-type variable to 'tls' to ensure that TLS encryption is used for secure connections.
  2. Step 2: Verify that the correct encryption method is being used by checking the Emacs documentation and server requirements.
  3. Step 3: Apply the changes and retry sending mail using Emacs.

🎯 Final Words

To resolve the 'SMTP protocol error' in Emacs, it's essential to correctly configure the authentication and encryption settings. By following the steps outlined above, users can successfully send mail through their SMTP server.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions