Mutt
is an open-source, text-based email client used in command-line
interfaces. Known for its simplicity, flexibility, and powerful
features, it supports various email protocols like IMAP and POP3.
Sending
emails is an indispensable requirement for an application developer or
system administrator. After Google disabled the less secure mail
setting, the scripts I used to send emails using Gmail accounts stopped
working.
By
activating the 2FA (Two-Factor Authentication) feature in your Gmail
account and defining an App, you can still use your scripts to send
emails by using the password you set for this app.
The steps you need to follow for this solution are outlined below.
Steps:
--
1. Enable MFA
2. Define App Password
3. Install Mutt
4. Example Config:
set from = "aliokan@gmail.com"
set realname = "KALE - Server"
#set imap_user = "aliokan@gmail.com"
#set imap_pass = "myverysecretpassword"
set smtp_url = "smtp://aliokan@smtp.gmail.com:587/"
set smtp_pass = "myverysecretpassword"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set ssl_starttls = yes
set ssl_force_tls = yes
## Opsiyonel: E-postaları yerel olarak saklamak için
#set header_cache = ~/.mutt/cache/headers
#set message_cachedir = ~/.mutt/cache/bodies
#set certificate_file = ~/.mutt/certificates
Test:
# echo "Bu bir test mesajıdır." | mutt -s "Test Konusu" targetmail@gmail.com
Possible error message:
No authenticators available
Could not send the message.
Solution:
# yum -y install cyrus-sasl-plain
(Platform: CentOS Linux release 7.9.2009 (Core))