Keywords: Gmail; mutt; linux; crontab; ubuntu

  • 安装 mutt 的源文件
 sudo apt-get install mutt 
  • configure mutt
 mkdir -p ~/.mutt/cache/headers

mkdir ~/.mutt/cache/bodies

touch ~/.mutt/certificates 
  • muttrc

在用户路径下 生成一个 .muttrc 文件

 vim ~/.muttrc 
set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user = "your_name@gmail.com"
set smtp_url = "smtp://your_name@smtp.gmail.com:587/"
set from='your_name@gmail.com'
set realname="YOUR SIGNATURE"
source "gpg -d ~/.mutt/password.gpg |"
set editor = "vim"
set folder ="imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed="+[Gmail]/Drafts"
set record = "+[Gmail]/Sent Mail"
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
set move = no

# setup for abook
set query_command = "abook --mutt-query '%s'"
macro generic,index,pager \ca "abook" "launch abook"
macro index,pager A "abook --add-email" "add sender to abook"

# basic colors ---------------------------------------------------------
color normal color241 color234
color error color160 color234
color tilde color235 color234
color message color37 color234
color markers color160 color254
color attachment color254 color234
color search color61 color234
color status color241 color235
color indicator color234 color136
color tree color136 color234 # arrow in threads</pre>
# basic monocolor screen
mono bold bold
mono underline underline
mono indicator reverse
mono error bold

# index ----------------------------------------------------------------
color index color160 color234 "~A" # all messages
color index color166 color234 "~E" # expired messages
color index color33 color234 "~N" # new messages
color index color33 color234 "~O" # old messages
color index color61 color234 "~Q" # messages that have been replied to
color index color240 color234 "~R" # read messages
color index color33 color234 "~U" # unread messages
color index color33 color234 "~U~$" # unread, unreferenced messages
color index color241 color234 "~v" # messages part of a collapsed thread
color index color241 color234 "~P" # messages from me
color index color37 color234 "~p!~F" # messages to me
color index color37 color234 "~N~p!~F" # new messages to me
color index color37 color234 "~U~p!~F" # unread messages to me
color index color240 color234 "~R~p!~F" # messages to me
color index color160 color234 "~F" # flagged messages
color index color160 color234 "~F~p" # flagged messages to me
color index color160 color234 "~N~F" # new flagged messages
color index color160 color234 "~N~F~p" # new flagged messages to me
color index color160 color234 "~U~F~p" # new flagged messages to me
color index color235 color160 "~D" # deleted messages
color index color245 color234 "~v~(!~N)" # collapsed thread with no unread
color index color136 color234 "~v~(~N)" # collapsed thread with some unread
color index color64 color234 "~N~v~(~N)" # collapsed thread with unread parent
# statusbg used to indicated flagged when foreground color shows other status
# for collapsed thread
color index color160 color235 "~v~(~F)!~N" # collapsed thread with flagged, no unread
color index color136 color235 "~v~(~F~N)" # collapsed thread with some unread &amp; flagged
color index color64 color235 "~N~v~(~F~N)" # collapsed thread with unread parent &amp; flagged
color index color64 color235 "~N~v~(~F)" # collapsed thread with unread parent, no unread inside, but some flagged
color index color37 color235 "~v~(~p)" # collapsed thread with unread parent, no unread inside, some to me directly
color index color136 color160 "~v~(~D)" # thread with deleted (doesn't differentiate between all or partial)
#color index color136 color234 "~(~N)" # messages in threads with some unread
#color index color64 color234 "~S" # superseded messages
#color index color160 color234 "~T" # tagged messages
#color index color166 color160 "~=" # duplicated messages

# message headers ------------------------------------------------------

#color header color240 color234 "^"
color hdrdefault color240 color234
color header color241 color234 "^(From)"
color header color33 color234 "^(Subject)"

# body -----------------------------------------------------------------

color quoted color33 color234
color quoted1 color37 color234
color quoted2 color136 color234
color quoted3 color160 color234
color quoted4 color166 color234

color signature color240 color234
color bold color235 color234
color underline color235 color234
color normal color244 color234
#
color body color245 color234 "[;:][-o][)/(|]" # emoticons
color body color245 color234 "[;:][)(|]" # emoticons
color body color245 color234 "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\
|FWIW|vbg|GD&amp;R|HTH|HTHBE|IMHO|IMNSHO|\
|IRL|RTFM|ROTFL|ROFL|YMMV)[*]?"
color body color245 color234 "[ ][*][^*]*[*][ ]?" # more emoticon?
color body color245 color234 "[ ]?[*][^*]*[*][ ]" # more emoticon?

## color for pgp
color body color160 color234 "(BAD signature)"
color body color37 color234 "(Good signature)"
color body color234 color234 "^gpg: Good signature .*"
color body color241 color234 "^gpg: "
color body color241 color160 "^gpg: BAD signature from.*"
mono body bold "^gpg: Good signature"
mono body bold "^gpg: BAD signature from.*"

# yes, an insance URL regex
color body color160 color234 "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&amp;=+$,-]|%[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_.!~*'()$,;:@&amp;=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&amp;=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&amp;=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&amp;=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&amp;=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&amp;=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&amp;=+$,-]|%[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_.!~*'():@&amp;=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&amp;=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&amp;=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&amp;=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&amp;=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&amp;=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n\"]"

# gpg setup
set pgp_replysign
set pgp_replysignencrypted
set pgp_verify_sig
set pgp_auto_decode

# please remember to change 3AD1D471B912CDE3 to your own user key id of gpg!

set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 3AD1D471B912CDE3 -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 3AD1D471B912CDE3 -- -r %r -- %f"
set pgp_import_command="gpg --no-verbose --import -v %f"
set pgp_export_command="gpg --no-verbose --export --armor %r"
set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r"
set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r"
set pgp_autosign=yes
set pgp_sign_as=3AD1D471B912CDE3
set pgp_replyencrypt=yes
set pgp_timeout=1800
set pgp_good_sign="^gpg: Good signature from" 

 

 

 

Advertisements

4 thoughts on “mutt 邮箱配置

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s