literate-dotfiles/dotfiles/mail.org

39 KiB

Mail Configuration

Synchronize Mailboxes - Mbsync

http://isync.sourceforge.net/

Global Defaults

# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *
# Permanently remove all messages [on the Master/Slave] marked for deletion.
Expunge Both

Gmail Account

IMAPAccount gmail
Host imap.gmail.com
User dehaeze.thomas@gmail.com
PassCmd "pass email/dehaeze.thomas@gmail.com"
SSLType IMAPS
AuthMechs LOGIN
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Path ~/.mail/gmail/
Inbox ~/.mail/gmail/Inbox

Channel gmail-Home
Master :gmail-remote:"INBOX"
Slave :gmail-local:Inbox

Channel gmail-Drafts
Master :gmail-remote:"[Gmail]/Drafts"
Slave :gmail-local:Drafts

Channel gmail-Sent
Master :gmail-remote:"[Gmail]/Sent Mail"
Slave :gmail-local:Sent

Channel gmail-Trash
Master :gmail-remote:"[Gmail]/Trash"
Slave :gmail-local:Trash

Channel gmail-All
Master :gmail-remote:"[Gmail]/All Mail"
Slave :gmail-local:Archive
# Catch-all for everything else: note that the `Patterns` have to exclude both
# the remote and local names for all the folders we want to exclude (except
# "INBOX", which is special-cased, it would seem).
Channel gmail
Master :gmail-remote:
Slave :gmail-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns *
Patterns !INBOX
Patterns ![Gmail]*
Patterns !Archive
Patterns !Drafts
Patterns !Sent Mail
Patterns !Trash
Patterns !Spam
Patterns !Starred
# For doing a quick sync of just the INBOX with `mbsync gmail-download`.
Channel gmail-download
Master :gmail-remote:"INBOX"
Slave :gmail-local:Inbox
Create Slave
Expunge Slave
Sync Pull

ESRF Account

IMAPAccount esrf
Host imaps.esrf.fr
User dehaeze
PassCmd "pass email/thomas.dehaeze@esrf.fr"
SSLType IMAPS
AuthMechs LOGIN
IMAPStore esrf-remote
Account esrf

MaildirStore esrf-local
Path ~/.mail/esrf/
Inbox ~/.mail/esrf/Inbox

Channel esrf-Home
Master :esrf-remote:"Inbox"
Slave :esrf-local:Inbox

Channel esrf-Drafts
Master :esrf-remote:"Drafts"
Slave :esrf-local:Drafts

Channel esrf-Archive
Master :esrf-remote:"Archive"
Slave :esrf-local:Archive

Channel esrf-Sent
Master :esrf-remote:"Sent"
Slave :esrf-local:Sent

Channel esrf-Trash
Master :esrf-remote:"Trash"
Slave :esrf-local:Trash
Channel esrf
Master :esrf-remote:
Slave :esrf-local:

For doing a quick sync of just the INBOX with `mbsync esrf-download`.

Channel esrf-download
Master :esrf-remote:"INBOX"
Slave :esrf-local:Inbox
Create Slave
Expunge Slave
Sync Pull

ULG Account

IMAPAccount ulg
Host mail.ulg.ac.be
User thomas.dehaeze@doct.uliege.be
PassCmd "pass email/thomas.dehaeze@doct.uliege.be"
SSLType IMAPS
AuthMechs LOGIN
IMAPStore ulg-remote
Account ulg

MaildirStore ulg-local
Path ~/.mail/ulg/
Inbox ~/.mail/ulg/Inbox

Channel ulg-Home
Master :ulg-remote:"Inbox"
Slave :ulg-local:Inbox

Channel ulg-Drafts
Master :ulg-remote:"Drafts"
Slave :ulg-local:Drafts

Channel ulg-Archive
Master :ulg-remote:"Archive"
Slave :ulg-local:Archive

Channel ulg-Sent
Master :ulg-remote:"Sent"
Slave :ulg-local:Sent

Channel ulg-Trash
Master :ulg-remote:"Trash"
Slave :ulg-local:Trash
Channel ulg
Master :ulg-remote:
Slave :ulg-local:

For doing a quick sync of just the INBOX with `mbsync ulg-download`.

Channel ulg-download
Master :ulg-remote:"Inbox"
Slave :ulg-local:Inbox
Create Slave
Expunge Slave
Sync Pull

Send Mails - Msmtp

https://marlam.de/msmtp/

Defaults

  defaults
  auth          on
  tls           on
  tls_certcheck off

Gmail Account

  account gmail
  host         smtp.gmail.com
  port         587
  protocol     smtp
  from         dehaeze.thomas@gmail.com
  user         dehaeze.thomas@gmail.com
  passwordeval "pass email/dehaeze.thomas@gmail.com"

ESRF Account

  account esrf
  host           smtps.esrf.fr
  port           465
  protocol       smtp
  from           thomas.dehaeze@esrf.fr
  user           dehaeze
  tls_starttls   off
  passwordeval   "pass email/thomas.dehaeze@esrf.fr"

ULG Account

  account ulg
  host           smtp.ulg.ac.be
  port           587
  protocol       smtp
  from           thomas.dehaeze@doct.uliege.be
  user           s177313
  tls_starttls   on
  passwordeval   "pass email/thomas.dehaeze@doct.uliege.be"

Default Account

  account default : gmail

Mail Client - NeoMutt

https://neomutt.org/

Documentation:

  man neomutt
  man neomuttrc

Bindings

TODO Vim Bindings

Unding toutes les touches (https://github.com/iagox86/mutt/blob/master/keybindings.conf) et rebind tout pour faire un truc coherent et documenté Rajouter les keybindings de vim https://github.com/neomutt/neomutt/issues/56#issuecomment-250780838

Unbind Few keys

  bind index,pager i noop
  bind index,pager g noop
  bind index,pager \# noop
  bind index \Cf noop

Index and Pager

  bind index,pager R group-reply
  bind index,pager s sync-mailbox

Navigation

  bind index <space>  collapse-thread

  bind index k  previous-entry
  bind pager k  previous-line
  bind index j  next-entry
  bind pager j  next-line
  bind index l  display-message
  bind index gg first-entry
  bind pager gg top
  bind index G  last-entry
  bind pager G  bottom

  bind attach,index,pager \CD next-page
  bind attach,index,pager \CU previous-page

  bind index h noop
  bind pager h exit

Index

  bind index u undelete-message

  bind index,pager P print-message

  bind index,pager p recall-message
  bind index,pager N search-opposite

  macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
  macro index,pager \cw "\
    :set my_tmp_pipe_decode=\$pipe_decode\n\
    :set pipe_decode\n\
    |urlview\n\
    :set pipe_decode=\$my_tmp_pipe_decode\n\
    :unset my_tmp_pipe_decode\n" \
    'call urlview to extract URLs out of a message'

Sync email

  macro index,pager o "<shell-escape>$HOME/.config/neomutt/bin/get_new_mail.sh<enter>"
  macro index,pager O "<shell-escape>$HOME/.config/neomutt/bin/get_new_mail.sh all<enter>"
Sync Mail script
  if [ "$1" = "all" ]; then
      command='mbsync --all'
  else
      command='mbsync gmail-Home esrf-Home ulg-Home'
  fi

  if [ $TMUX ]; then
      tmux split -v -l 1 $command && tmux select-pane -U
  else
      $command
  fi

Copy and move dialogs

  macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
  macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"

Quickly change mailboxes

  macro index,pager c "<change-folder>?<toggle-mailboxes>" "change folder"

TODO Labels

  bind index,pager y edit-label

Open in Vim

  bind index,pager V noop
  macro index,pager V "|nvim -c 'setlocal ft=mail' -c 'setlocal buftype=nofile' -<enter>"              "open in vim"

Make quick html view macro

  bind index,pager H  noop # Unbinds V from version
  macro index,pager H "<view-attachments><search>html<enter><view-mailcap><exit>"

Mouse wheel

  bind pager \031 previous-line # Mouse wheel
  bind pager \005 next-line # Mouse wheel

TODO [A] Contacts

  macro pager \Ca "<pipe-message> goobook add<return>" "add the sender address to Google contacts"

Compose

  bind compose p postpone-message

  bind compose R rename-attachment

  bind compose a attach-file

Use urlview to extract urls from the mail.

  macro attach,compose \cw "\
    :set my_tmp_pipe_decode=\$pipe_decode\n\
    :set pipe_decode\n\
    |urlview\n\
    :set pipe_decode=\$my_tmp_pipe_decode\n\
    :unset my_tmp_pipe_decode\n" \
    'call urlview to extract URLs out of a message'
TODO - Write html emails using markdown
  # macro compose M "F pandoc -s -f markdown -t html \ny^T^Utext/html; charset=us-ascii\n"
TODO Open another instance of neomutt in readonly mode while composing
  macro compose M "<shell-escape>termite -e \"neomutt -R\"<enter>"

TODO [A] Sidebar

  bind index,pager \Ck sidebar-prev
  bind index,pager \Cj sidebar-next
  bind index,pager \Co sidebar-open
  bind index,pager \Cp sidebar-prev-new
  bind index,pager \Cn sidebar-next-new
  bind index,pager B sidebar-toggle-visible

Attachments

  bind attach <return> view-mailcap

  macro attach W <save-entry><kill-line>~/Downloads/<enter>y "Save entry"

TODO Colors

Mutt template by Robert Timm (https://github.com/rti) Base16 scheme and Base16 Builder by Chris Kempson (https://github.com/chriskempson)

~A all messages
~b EXPR messages which contain EXPR in the message body
~B EXPR messages which contain EXPR in the whole message
~c USER messages carbon-copied to USER
~C EXPR message is either to: or cc: EXPR
~D deleted messages
~d [MIN]-[MAX] messages with ``date-sent'' in a Date range
~E expired messages
~e EXPR message which contains EXPR in the ``Sender'' field
~F flagged messages
~f USER messages originating from USER
~g PGP signed messages
~G PGP encrypted messages
~h EXPR messages which contain EXPR in the message header
~k message contains PGP key material
~i ID message which match ID in the ``Message-ID'' field
~L EXPR message is either originated or received by EXPR
~l message is addressed to a known mailing list
~m [MIN]-[MAX] message in the range MIN to MAX *)
~n [MIN]-[MAX] messages with a score in the range MIN to MAX *)
~N new messages
~O old messages
~p message is addressed to you (consults $alternates)
~P message is from you (consults $alternates)
~Q messages which have been replied to
~R read messages
~r [MIN]-[MAX] messages with ``date-received'' in a Date range
~S superseded messages
~s SUBJECT messages having SUBJECT in the ``Subject'' field.
~T tagged messages
~t USER messages addressed to USER
~U unread messages
~v message is part of a collapsed thread.
~x EXPR messages which contain EXPR in the `References' field
~y EXPR messages which contain EXPR in the `X-Label' field
~z [MIN]-[MAX] messages with a size in the range MIN to MAX *)
~= duplicated messages (see $duplicate_threads)
# basic colors
#     name        foreground  background  pattern
color normal      color20     color0
color error       color1      color0
color tilde       color20     color0
color message     color20     color0
color markers     color1      color0
color attachment  color8      color0
color search      color2      color0
color status      color8      color18
color indicator   color7      color19
color tree        color19     color0                  # arrow in threads

color index       color20     color0       "~A"       # all messages
color index       color1      color0       "~F"       # flagged messages
color index       color20     color0       "~v~(!~N)" # collapsed thread with no unread
color index       color4      color0       "~U"       # unread messages
color index       color4      color0       "~v~(~N)"  # collapsed thread with some unread
color index       color1      color0       "~v~(~F)"  # collapsed thread with some flagged
color index       color0      color1       "~D"       # deleted messages

# header
color hdrdefault  color20     color18
color header      color20     color18      "^"
color header      color7      color18      "^(From)"
color header      color7      color18      "^(Subject)"

# body
color normal      color7      color0
color underline   color7      color0
color bold        color7      color0
color signature   color20     color0

color quoted      color3      color0
color quoted1     color2      color0
color quoted2     color5      color0
color quoted3     color6      color0
color quoted4     color4      color0

# pgp
color body        color2      color0       "(Good signature)"
color body        color2      color0       "^gpg: Good signature .*"
color body        color20     color0       "^gpg: "
color body        color1      color0       "(BAD signature)"
color body        color1      color1       "^gpg: BAD signature from.*"

# body url
color body        color4      color0       "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
# body email
color body        color4      color0       "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])"

Colors OLD

Basic colors

color normal        brightblue      default
color error         red             default
color tilde         white           default
color message       cyan            default
color markers       red             black
color attachment    black           default
color search        brightmagenta   default
color status        brightblue      white
color indicator     brightwhite     yellow
color tree          yellow          default

# basic monocolor screen
mono  bold          bold
mono  underline     underline
mono  indicator     reverse
mono  error         bold

Index

#color index         red             default         "~D(!~p|~p)"               # deleted
#color index         white           default         ~F                         # flagged
#color index         brightred       default         ~=                         # duplicate messages
#color index         brightcyan      default         "~A!~N!~T!~p!~Q!~F!~D!~P"  # the rest
#color index         J_base          default         "~A~N!~T!~p!~Q!~F!~D"      # the rest, new
color index         red             default         "~A"                        # all messages
color index         brightred       default         "~E"                        # expired messages
color index         blue            default         "~N"                        # new messages
color index         blue            default         "~O"                        # old messages
color index         brightmagenta   default         "~Q"                        # messages that have been replied to
color index         brightcyan      default         "~R"                        # read messages
color index         blue            default         "~U"                        # unread messages
color index         blue            default         "~U~$"                      # unread, unreferenced messages
color index         brightblue      default         "~v"                        # messages part of a collapsed thread
color index         brightblue      default         "~P"                        # messages from me
color index         cyan            default         "~p!~F"                     # messages to me
color index         cyan            default         "~N~p!~F"                   # new messages to me
color index         cyan            default         "~U~p!~F"                   # unread messages to me
color index         brightcyan      default         "~R~p!~F"                   # messages to me
color index         red             default         "~F"                        # flagged messages
color index         red             default         "~F~p"                      # flagged messages to me
color index         red             default         "~N~F"                      # new flagged messages
color index         red             default         "~N~F~p"                    # new flagged messages to me
color index         red             default         "~U~F~p"                    # new flagged messages to me
color index         white           red             "~D"                        # deleted messages
color index         brightgreen     default         "~v~(!~N)"                  # collapsed thread with no unread
color index         yellow          default         "~v~(~N)"                   # collapsed thread with some unread
color index         green           default         "~N~v~(~N)"                 # collapsed thread with unread parent
# statusbg used to indicated flagged when foreground color shows other status
# for collapsed thread
color index         red             white           "~v~(~F)!~N"                # collapsed thread with flagged, no unread
color index         yellow          white           "~v~(~F~N)"                 # collapsed thread with some unread & flagged
color index         green           white           "~N~v~(~F~N)"               # collapsed thread with unread parent & flagged
color index         green           white           "~N~v~(~F)"                 # collapsed thread with unread parent, no unread inside, but some flagged
color index         cyan            white           "~v~(~p)"                   # collapsed thread with unread parent, no unread inside, some to me directly
color index         yellow          red             "~v~(~D)"                   # thread with deleted (doesn't differentiate between all or partial)
#color index         yellow          default         "~(~N)"                    # messages in threads with some unread
#color index         green           default         "~S"                       # superseded messages
#color index         red             default         "~T"                       # tagged messages
#color index         brightred       red             "~="                       # duplicated messages

Message headers

color hdrdefault    brightcyan      default
color header        brightblue      default         "^(From)"
color header        blue            default         "^(Subject)"

Body

color quoted        blue            default
color quoted1       cyan            default
color quoted2       yellow          default
color quoted3       red             default
color quoted4       brightred       default

color signature     brightcyan      default
color bold          white           default
color underline     white           default
color normal        default         default

color body          brightgreen     default         "[;:][-o][)/(|]"    # emoticons
color body          brightgreen     default         "[;:][)(|]"         # emoticons
color body          brightgreen     default         "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\
                                                     |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\
                                                     |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?"
color body          brightgreen     default         "[ ][*][^*]*[*][ ]?" # more emoticon?
color body          brightgreen     default         "[ ]?[*][^*]*[*][ ]" # more emoticon?

PGP

color body          red             default         "(BAD signature)"
color body          cyan            default         "(Good signature)"
color body          brightwhite     default         "^gpg: Good signature .*"
color body          brightblue      default         "^gpg: "
color body          brightblue      red             "^gpg: BAD signature from.*"
mono  body          bold                            "^gpg: Good signature"
mono  body          bold                            "^gpg: BAD signature from.*"

Urls

color body red default         "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"

Emails

  # color body J_magent default "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])"

Various smilies and the like

#color body          brightblack     default         "<[Gg]>"                            # <g>
#color body          brightblack     default         "<[Bb][Gg]>"                        # <bg>
#color body          yellow          default         " [;:]-*[})>{(<|]"                  # :-) etc...
# *bold*
#color body          blue            default         "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)"
#mono  body          bold                            "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)"
# _underline_
#color body          blue            default         "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)"
#mono  body          underline                       "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)"
# /italic/  (Sometimes gets directory names)
#color body         blue            default         "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)"
#mono body          underline                       "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)"

# Border lines.
#color body          blue            default         "( *[-+=#*~_]){6,}"

#folder-hook .                  "color status        J_black         J_status        "
#folder-hook gmail/inbox        "color status        J_black         yellow          "
#folder-hook gmail/important    "color status        J_black         yellow          "

Sidebar

  # Should the Sidebar be shown?
  set sidebar_visible = yes

  # How wide should the Sidebar be in screen columns?
  # Note: Some characters, e.g. Chinese, take up two columns each.
  set sidebar_width = 20

  # Should the mailbox paths be abbreviated?
  set sidebar_short_path = yes

  # When abbreviating mailbox path names, use any of these characters as path
  # separators.  Only the part after the last separators will be shown.
  # For file folders '/' is good.  For IMAP folders, often '.' is useful.
  set sidebar_delim_chars = '/.'

  # If the mailbox path is abbreviated, should it be indented?
  set sidebar_folder_indent = yes

  # Indent mailbox paths with this string.
  set sidebar_indent_string = '  '

  # Make the Sidebar only display mailboxes that contain new, or flagged,
  # mail.
  set sidebar_new_mail_only = no

  # Any mailboxes that are whitelisted will always be visible, even if the
  # sidebar_new_mail_only option is enabled.
  # sidebar_whitelist '/home/user/mailbox1'
  # sidebar_whitelist '/home/user/mailbox2'

  # When searching for mailboxes containing new mail, should the search wrap
  # around when it reaches the end of the list?
  set sidebar_next_new_wrap = no

  # Show the Sidebar on the right-hand side of the screen
  set sidebar_on_right = no

  # The character to use as the divider between the Sidebar and the other Mutt
  # panels.
  # Note: Only the first character of this string is used.
  set sidebar_divider_char = '│'

  # Enable extended buffy mode to calculate total, new, and flagged
  # message counts for each mailbox.
  set mail_check_stats

  # Display the Sidebar mailboxes using this format string.
  set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'

  # Sort the mailboxes in the Sidebar using this method:
  #       count    - total number of messages
  #       flagged  - number of flagged messages
  #       new      - number of new messages
  #       path     - mailbox path
  #       unsorted - do not sort the mailboxes
  set sidebar_sort_method = 'unsorted'

Searching using Mu

  # mutt macros for mu
  macro index,pager \Cf "<shell-escape>mu find --clearlinks --format=links --linksdir=~/.mail/search " \
                           "mu find"
  macro index,pager gf "<change-folder-readonly>~/.mail/search<enter>" \
                           "mu find results"

Contacts with Mu

  # set query_command="goobook query '%s'"
  # set query_command="lbdbq '%s'"
  set query_command="mu cfind '%s' -o mutt-ab"

  bind editor <Tab> complete-query

Paths

  set folder           = ~/.mail                # mail location
  set alias_file       = ~/.config/neomutt/alias          # where to store aliases
  set header_cache     = ~/.config/neomutt/cache/headers  # where to store headers
  set message_cachedir = ~/.config/neomutt/cache/bodies   # where to store bodies
  set certificate_file = ~/.config/neomutt/certificates   # where to store certs
  # set mailcap_path     = ~/.config/neomutt/config/mailcap # entries for filetypes
  set tmpdir           = ~/.config/neomutt/temp           # where to keep temp files

TODO Mailcap configuration

TODO [A] Print

https://unix.stackexchange.com/questions/20456/pretty-print-mails-from-mutt

  set print_command="/usr/bin/muttprint %s -p ctb110c1u"

Accounts

  set spoolfile = "+gmail/Inbox" # Default inbox
  set realname = "Dehaeze Thomas"
  set from = "dehaeze.thomas@gmail.com"

  folder-hook gmail/* source ~/.config/neomutt/accounts/gmail
  folder-hook esrf/*  source ~/.config/neomutt/accounts/esrf
  folder-hook ulg/*   source ~/.config/neomutt/accounts/ulg

  macro index,pager gu "<change-folder>+ulg/Inbox<enter>" "go to inbox"
  macro index,pager ge "<change-folder>+esrf/Inbox<enter>" "go to inbox"
  macro index,pager gm "<change-folder>+gmail/Inbox<enter>" "go to inbox"

Gmail

Configuration
  set from     = "dehaeze.thomas@gmail.com"
  set sendmail = "msmtp -a gmail"

  # Other special folders.
  set mbox      = "+gmail/Archive"
  unset record # Don't copy send message to Sent folder: Gmail does that for us
  set postponed = "+gmail/Drafts"

  set signature = "~/.config/neomutt/accounts/gmail.signature"

  color status cyan default

  macro index,pager d \
    "<save-message>+gmail/Archive<enter>" \
    "Move message to the Archive"

  macro index,pager D \
    "<save-message>+gmail/Trash<enter>" \
    "Move message to the Trash"
Signature
  Thomas Dehaeze

This empty code block is used to add a new line after signatude

ESRF

Configuration
  set from     = "thomas.dehaeze@esrf.fr"
  set sendmail = "msmtp -a esrf"

  # Other special folders.
  set mbox      = "+esrf/Archive"
  set record    = "+esrf/Sent"
  set postponed = "+esrf/Drafts"

  set signature = "~/.config/neomutt/accounts/esrf.signature"

  color status cyan default

  macro index,pager d \
    "<save-message>+esrf/Archive<enter>" \
    "Move message to the Archive"

  macro index,pager D \
    "<save-message>+esrf/Trash<enter>" \
    "Move message to the Trash"
Signature
  Thomas Dehaeze

This empty code block is used to add a new line after signatude

ULG

Configuration
  set from     = "thomas.dehaeze@doct.uliege.be"
  set sendmail = "msmtp -a ulg"

  # Other special folders.
  set mbox      = "+ulg/Archive"
  set record    = "+ulg/Sent"
  set postponed = "+ulg/Drafts"

  set signature = "~/.config/neomutt/accounts/ulg.signature"

  color status cyan default

  macro index,pager d \
    "<save-message>+ulg/Archive<enter>" \
    "Move message to the Archive"

  macro index,pager D \
    "<save-message>+ulg/Trash<enter>" \
    "Move message to the Trash"
Signature
  Thomas Dehaeze

This empty code block is used to add a new line after signatude

Mailboxes to show in the sidebar.

  mailboxes \
      +search \
      "+Google" \
      +gmail/Inbox \
      +gmail/Archive \
      +gmail/Drafts \
      +gmail/Sent \
      +gmail/Trash \
      "+ESRF" \
      +esrf/Inbox \
      +esrf/Archive \
      +esrf/Drafts \
      +esrf/Sent \
      +esrf/Trash \
      "+ULG" \
      +ulg/Inbox \
      +ulg/Archive \
      +ulg/Drafts \
      +ulg/Sent \
      +ulg/Trash \

  set sendmail_wait = 0 # no please don't silently fail, email is important
  unset move

Use Vim to compose email, with a few default options.

set editor = "nvim -c '/\\n--' -c ':noh' -c 'startinsert' -c ':Goyo'"

Basic Options

  set wait_key = no        # shut up, mutt
  set mbox_type = Maildir  # mailbox type
  set help = no            # No top bar
  set timeout = 3          # idle time before scanning
  set sleep_time = 0       # how long NeoMutt may wait after an error message
  set mail_check = 0       # minimum time between scans
  set delete               # don't ask, just do
  unset confirmappend      # don't ask, just do!
  set quit                 # don't ask, just do!!
  set mark_old = no        # read/new is good enough for me
  set beep_new             # bell on new mails
  # set pipe_decode          # strip headers and eval mimes when piping
  set thorough_search      # strip headers and eval mimes before searching
  set send_charset="us-ascii:utf-8:iso-8859-1"
  set use_from             # respect the From: address the editor sends back

Status Bar

  set status_on_top = no
  set status_chars  = " *%A"
  set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"

Index View Options

  set date_format = "%d/%m/%y %H:%M"
  set index_format = "[%Z] %D  %-20.20F %s"
  # set index_format = " %Z %<[y?%<[m?%<[d?%[     %H:%M]&%[    %a %d]>&%[    %b %d]>&%[%d/%m/%Y]> %-30.30F %<M?(%2M)&    > %?GS?%GS& ?%?GE?%GE& ?%?GA?%GA& ? %g %s"
  # set index_format='%4C %S %[%y.%m.%d] %-18.18n %?GU?%GU& ? %?GR?%GR& ? %?GI?%GI& ? %s'

  set sort = threads                         # like gmail
  set sort_aux = reverse-last-date-received  # like gmail
  set uncollapse_jump                        # don't collapse on an unread message
  set sort_re                                # thread based on regex
  set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
  set folder_format = "%2C %t %N %8s %f"

Pager View Options

  set pager_index_lines = 10 # number of index lines to show
  set pager_context = 3      # number of context lines to show
  set pager_stop             # don't go to next message automatically
  set menu_scroll            # scroll in menus
  set tilde                  # show tildes like in vim
  set markers = no           # no ugly plus signs
  set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"

  auto_view text/html                                      # view html automatically
  alternative_order text/plain text/enriched text/html     # save html for last

Compose View Options

  set envelope_from                    # which from?
  set sig_dashes                       # dashes before sig
  set sig_on_top                       # the signature is just below the response
  set edit_headers                     # show headers when composing
  set fast_reply                       # skip to compose when replying
  set askcc                            # ask for CC:
  set fcc_attach                       # save attachments with the body
  set mime_forward = yes               # forward attachments as part of body
  set forward_format = "Fwd: %s"       # format of subject when forwarding
  set forward_decode                   # decode when forwarding
  set attribution = "On %d, %n wrote:" # format of quoting header
  set reply_to                         # reply to Reply to: field
  set reverse_name                     # reply as whomever it was to
  set include                          # include message in replies
  set forward_quote                    # include message in forwards

Attachment View Options

  set attach_format = "[%D %t] %2n [%-7.7m/%10.10M] %.40d %> [%s] "

Headers

  ignore *                                # ignore all headers
  unignore from: to: cc: date: subject:   # show only these
  unhdr_order *
  hdr_order from: to: cc: date: subject:  # and in this order

Progress Bar

  color progress white red

TODO Open PDF from mail

~/scripts/openfile.sh

TODO [B] Integrate with contact manager

TODO [A] Attachments

Open Attachments

A script is used to open the attachment with the default application: it seems this script is not use at the moment

  base=$(basename "$1")
  ext="${base##*.}"

  file=$(mktemp -u --suffix=".$ext")

  rm -f "$file"

  cp "$1" "$file"

  setsid xdg-open "$file" >/dev/null 2>&1 &

Attach multiple files at once

First, tag the files you want to send using t, then ; to apply the action on all tagged files and finally <enter> to add them all.

Forgotten Attachment

  set abort_noattach = ask-yes
  set abort_noattach_regex = "\\<(attach(|ed|ments?)|(attaché|attachés|attache|attachons|joint|jointe|joints|jointes|joins|joignons))\\>"

TODO [B] Attach file using GUI File Manager

  # macro compose A "<shell-escape>bash $HOME/.config/neomut/bin/attach-file.sh<enter><enter-command>source /tmp/muttpick<enter>" "Attach with GUI"

TODO Notification system

A script (~/scripts/checkmail.sh) is used to retreive new mails and use notify=send is there are new received mails.