SASL Authentication Failed to Send Mail with Mutt and Gmail

Abstract: Resolve Mutt SASL authentication failures with Gmail by generating an App Password and configuring SMTP port 587 or 465.

Created: 2026-10-07 by

Solving the "SASL authentication failed" error in Mutt when using Gmail requires switching to App Passwords and configuring the correct SMTP ports. Legacy "Less secure app access" is no longer supported, so you must generate a 16-character application-specific password from your Google Account security settings and set set smtp_url to use port 587 with STARTTLS or port 465 with implicit SSL.

Understanding the Authentication Failure

The error message SASL authentication failed in Mutt typically indicates that the Simple Authentication and Security Layer (SASL) mechanism rejected your credentials during the handshake with Gmail's SMTP server. In the past, users could enable "Less secure app access" in their Google Account settings to allow direct password usage. However, Google has completely disabled this feature for most accounts to enhance security. Consequently, standard account passwords no longer work for third-party clients like Mutt, Alpine, or Thunderbird. This change forces all non-Gmail clients to use OAuth2 or Application-Specific Passwords. Since Mutt does not natively support the complex OAuth2 flow required by modern Google APIs without additional plugins, the most reliable solution is to generate an App Password. This is a unique, 16-character code that grants your email client permission to send mail on your behalf. Without this specific credential, any attempt to authenticate will fail with the SASL error, regardless of how correctly the rest of your configuration is written.

Generating an App Password

Before modifying your Mutt configuration, you must obtain the valid credentials from Google. Follow these steps to create an App Password:
  1. Navigate to your Google Account page and select the Security tab from the left-hand menu.
  2. Ensure that 2-Step Verification is turned on. If it is not, you cannot create App Passwords. Enable it if necessary.
  3. Once 2-Step Verification is active, look for the App Passwords option. You may need to search for it in the search bar within the Security section.
  4. Select Mail as the app and choose Other (Custom name) as the device. Name it something recognizable, such as "Mutt Linux".
  5. Click Generate. Google will display a 16-character password. Copy this password immediately, as it will not be shown again.
This password replaces your regular Google account password in your Mutt configuration. It is critical that you do not include spaces between the characters when copying, as this will cause authentication errors.

Configuring Mutt for SMTP

With the App Password in hand, you need to update your ~/.muttrc file. The configuration involves setting the SMTP URL, specifying the authentication method, and providing the new credentials. First, define the SMTP server details. You have two primary options for connecting to Gmail: Port 587 with STARTTLS or Port 465 with implicit SSL. Port 587 is generally recommended for its flexibility and widespread support. ``` set smtp_url = "smtp://YOUR_EMAIL%[email protected]:587/" set smtp_pass = "YOUR_APP_PASSWORD" set ssl_starttls = yes set smtp_auth = login ``` In the smtp_url, replace YOUR_EMAIL with your full Gmail address. Note that the @ symbol must be encoded as %40 to ensure proper parsing. Replace YOUR_APP_PASSWORD with the 16-character code generated earlier. The ssl_starttls = yes directive ensures that the connection starts unencrypted and upgrades to TLS after the initial handshake, which is standard for port 587. If you prefer to use port 465, which uses implicit SSL/TLS from the start, the configuration changes slightly. You must disable STARTTLS and enable standard SSL. ``` set smtp_url = "smtps://YOUR_EMAIL%[email protected]:465/" set smtp_pass = "YOUR_APP_PASSWORD" set ssl_starttls = no set ssl_force_tls = yes set smtp_auth = login ``` Notice the use of smtps:// instead of smtp://. This tells Mutt to expect an immediate SSL connection. Using -starttls smtp with port 465 is incorrect and will result in connection failures because port 465 does not support the STARTTLS extension; it relies entirely on implicit encryption.

Testing the Connection

After saving your configuration, test the setup by sending a test email. You can do this directly from the command line to isolate potential issues before composing a full message in Mutt. Use the following command, replacing the placeholders with your actual data: ``` echo "Test Message" | mutt -s "Test Subject" [email protected] ``` If the email sends successfully, your configuration is correct. If you encounter errors, check the following common pitfalls:
  • Incorrect Encoding: Ensure there are no extra spaces in the smtp_url or smtp_pass lines.
  • Port Mismatch: Verify that you are using smtp:// with ssl_starttls = yes for port 587, and smtps:// with ssl_force_tls = yes for port 465.
  • Firewall Issues: Ensure your local firewall allows outbound connections on ports 587 or 465.
For more information on managing Gmail accounts across different clients, see our guide on How to read All Mail on IMAP Gmail with the Alpine / Pine e-mail client?. Additionally, if your emails are being blocked or marked incorrectly after fixing authentication, refer to our troubleshooting guide on Email ends up in Spam - Troubleshooting Guide.

Frequently Asked Questions

Why did my old password stop working?

Google disabled "Less secure app access" to improve account security, requiring stronger authentication methods. Standard passwords are no longer accepted by third-party SMTP servers unless they are replaced by App Passwords or OAuth2 tokens.

Can I use OAuth2 with Mutt instead of App Passwords?

While possible, OAuth2 support in Mutt is complex and often requires external helper scripts or patches that are not included in standard distributions. App Passwords provide a simpler, native solution that works reliably with the built-in SMTP capabilities of Mutt.

What is the difference between port 587 and 465?

Port 587 uses STARTTLS, where the connection begins unencrypted and upgrades to TLS after authentication negotiation. Port 465 uses implicit SSL, meaning the entire connection is encrypted from the very first byte. Both are secure, but 587 is the modern standard for submission.

How do I revoke an App Password if I suspect it was compromised?

You can manage your App Passwords by going to your Google Account Security settings, selecting "App Passwords," and clicking the trash icon next to the specific password you wish to revoke. This immediately invalidates that code.

Why do I get a certificate error even with the correct settings?

This usually happens if you are using port 465 but have ssl_starttls enabled, or vice versa. Ensure that ssl_starttls = no and ssl_force_tls = yes for port 465, and ssl_starttls = yes for port 587 to match the expected encryption behavior.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More