Skip to content

Instantly share code, notes, and snippets.

@VladimirPal
Last active March 30, 2024 11:59
Show Gist options
  • Save VladimirPal/9068b922c70a6b5e604c8d2eb099ddb7 to your computer and use it in GitHub Desktop.
Save VladimirPal/9068b922c70a6b5e604c8d2eb099ddb7 to your computer and use it in GitHub Desktop.
Minimal neomutt config for gmail imap
set imap_user="mail.vpal@gmail.com"
set imap_pass=`/usr/bin/security find-generic-password -w -a 'mail.vpal@gmail.com' -s 'Gmail'`
set folder=imaps://imap.gmail.com/
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed="+[Gmail]/Drafts"
# https://www.neomutt.org/guide/reference search sleep_time for additional info
set sleep_time=0 # be faster
set beep=no # no beep sound
set editor="/Applications/MacVim.app/Contents/MacOS/Vim -c 'set tw=74' -c 'set wrap'"
auto_view text/html
set sort=reverse-date # default sorting by date
# When sorting by threads, this variable controls how threads are sorted
# in relation to other threads, and how the branches of the thread trees are sorted.
set sort_aux=last-date-received
# Index page format. Default "%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s"
set index_format="%4C %Z %{%b %d %R} %-15.15L (%?l?%4l&%4c?) %s"
set sidebar_visible
set sidebar_format="%B%?F? [%F]?%* %?N?%N/?%S"
set mail_check_stats
# You can use any gmail imap mailboxes
mailboxes =INBOX =[Gmail]/Sent\ Mail =[Gmail]/Drafts =[Gmail]/Spam =[Gmail]/Trash
# Vim like binds
bind attach,index,pager \CD next-page
bind attach,index,pager \CU previous-page
bind pager g top
bind pager G bottom
bind attach,index g first-entry
bind attach,index G last-entry
# Sidebar binds
bind index,pager \CP sidebar-prev # Ctrl-n to select next folder
bind index,pager \CN sidebar-next # Ctrl-p to select previous folder
bind index,pager \CI sidebar-open # Ctrl-o to open selected folder
bind index,pager \CB sidebar-toggle-visible # Ctrl-b to toggle visibility of the sidebar
set realname="Vladimir Pal"
set from="mail.vpal@gmail.com"
set smtp_url="smtps://mail.vpal@gmail.com@smtp.gmail.com:465/"
set smtp_pass=`/usr/bin/security find-generic-password -w -a 'mail.vpal@gmail.com' -s 'Gmail'`
set smtp_authenticators="gssapi:login"
@DDzwiedziu
Copy link

What is /usr/bin/security?

@JamieMagee
Copy link

@yosukesan
Copy link

I almost copied this setup on Debian 10. For linux users, 'pass' is one of the alternatives to 'security'.
https://github.com/zx2c4/password-store

@bryanmobrien
Copy link

Thank you for this gist. Very helpful for me setting up neomutt and gmail on macOS Catalina.

@0rtz
Copy link

0rtz commented Nov 2, 2021

If you do set record="+[Gmail]/Sent Mail" sent messages will be duplicated in [Gmail]/Sent Mail tho

@Freed-Wu
Copy link

I always meet gnutls_handshake: The TLS connection was non-properly terminated. when I send mail, although I can receive mail successfully.

@harinathselvaraj
Copy link

Hi @VladimirPal I am have used the config but it neomutt couldn't login. Is it because of Gmail blocking less secure apps ?

@KevoTHRASHER
Copy link

I always meet gnutls_handshake: The TLS connection was non-properly terminated. when I send mail, although I can receive mail successfully.

set smtp_url = "smtps://myemail@domain.ca@smtp-mail.outlook.com:587"
Port 587 is not smtps, but plain SMTP with optional upgrade to TLS using STARTTLS command. smtps is instead on port 465.

The "unexpected TLS packet was received" is the result of trying to interpret the non-TLS data (server welcome message) initially received on port 587 as TLS, which fails.

check this page

https://unix.stackexchange.com/questions/667464/mutt-error-sending-mail-gnutls-handshake-an-unexpected-tls-packet-was-received

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment