Using mutt for sending emails via my gmail account has been something I wanted to do for a long time. After my last issue with my laptop, finally I decided to learn how to do it.
Thanks to these blogs I managed to get it working!!!
sudo aptitude install mutt mkdir ~/.mutt vim ~/.mutt/muttrc
This is the content of my file:
set from = "email@example.com" set realname = "Name Surname" # IMAP settings set imap_user = "firstname.lastname@example.org" set imap_pass = "your_new_app_password" # SMTP settings set smtp_url = "smtps://email@example.com" set smtp_pass = "your_new_app_password" # Remote Gmail folders set folder = "imaps://imap.gmail.com/" set spoolfile = "+INBOX" set postponed = "+[Gmail]/Drafts" set trash = "+[Gmail]/Trash" # Composition set editor = "vim" set edit_headers = yes set charset = UTF-8
This is the error I had before getting the app password:
$ echo "Example mutt+gmail" | mutt -s "Testing mutt+gmail" firstname.lastname@example.org -a test.txt SASL authentication failed Could not send the message. $
After that. Email sent fine without error and I can see it in my inbox!
$ echo "Example mutt+gmail v2" | mutt -s "Testing mutt+gmail v2" email@example.com -a books.ods $
The only thing I dont like is I need to have a password in a text file….
So let’s use chmod so, at least, only me can read the file.
~/.mutt$ chmod og-r muttrc ~/.mutt$ ls -ltr total 4 -rw------- 1 yy yy 687 Oct 26 23:22 muttrc ~/.mutt$
Although, Ideally, I would prefer to use a certificate that is only valid for gmail, but I haven’t been able to find anything related to this.