都说mutt方便,稳定,是基于命令行的。但是可能需要一定的配置,开始自己也不确定能否成功,就尝试了一次。详细mutt的说明就问问百度什么的(谷歌总被封)。
我用的是getmail+mutt+sendmail,因为这个搜索到的比较多。fetchmail postfix其它的网上也有,我也没弄,个人还是有点懒惰的:P 直接来配置文件(都在/home/ydjx下)
第一次进入mutt会自动建立一个Mail的文件夹,然后需要自己建立几个文件夹inbox postponed sent,inbox里还有cur tmp new (这个是按照那个getmail那配置的Maildir来的 之前看过还有其它的类型但不记得了)
.muttrc 从别的地方抄来的 (我的环境语言是utf8的)
- #
- # System configuration file for Mutt
- #
- #
- # default list of header fields to weed when displaying
- #
- ignore "from " received content- mime-version status x-status message-id
- ignore sender references return-path lines
- ignore date delivered-to precedence errors-to in-reply-to user-agent
- ignore x-loop x-sender x-mailer x-msmail-priority x-mimeole x-ms- x-priority
- ignore x-accept-language x-authentication-warning thread- priority importance
- ignore x-original-to domainkey-signature dkim-signature
- #
- # emacs-like bindings
- bind editor "\e" kill-word
- bind editor "\e" kill-word
- #
- # map delete-char to a sane value
- bind editor delete-char
- #
- # some people actually like these settings
- #set pager_stop
- #bind pager previous-line
- #bind pager next-line
- #
- # don't add the hostname to the From header
- unset use_domain
- # don't generate a From header
- unset use_from
- #
- # Specifies how to sort messages in the index menu.
- set sort=threads
- #
- # Exim does not remove Bcc headers
- unset write_bcc
- # Postfix and qmail use Delivered-To for detecting loops
- unset bounce_delivered
- #
- # weed out binary-only announcements to -devel-changes
- #macro index \CW T!~s\(.*source.*\)\nWn^T~A\n "Weed out binary-only announcements"
- #
- # imitate the old search-body function
- macro index \eb "~b " "search in message bodies"
- #
- # simulate the old url menu
- macro index,pager \cb " urlview" "call urlview to extract URLs out of a message"
- macro attach,compose \cb " urlview" "call urlview to extract URLs out of a message"
- #
- # Show documentation when pressing F1
- macro generic "!zcat /usr/share/doc/mutt/manual.txt.gz | sensible-pager\n" "Show Mutt documentation"
- macro index "!zcat /usr/share/doc/mutt/manual.txt.gz | sensible-pager\n" "Show Mutt documentation"
- macro pager "!zcat /usr/share/doc/mutt/manual.txt.gz | sensible-pager\n" "Show Mutt documentation"
- #
- # Use folders which match on \\.gz$ or \\.bz2$ as [gb]zipped folders:
- open-hook \\.gz$ "gzip -cd %f > %t"
- close-hook \\.gz$ "gzip -c %t > %f"
- append-hook \\.gz$ "gzip -c %t >> %f"
- open-hook \\.bz2$ "bzip2 -cd %f > %t"
- close-hook \\.bz2$ "bzip2 -c %t > %f"
- append-hook \\.bz2$ "bzip2 -c %t >> %f"
- #
- # show the incoming mailboxes list (just like "mutt -y") and back when pressing "y"
- macro index,pager y "?" "show incoming mailboxes list"
- bind browser y exit
- #
- # If Mutt is unable to determine your site's domain name correctly, you can
- # set the default here.
- #
- # set hostname=cs.hmc.edu
- #
- # If your sendmail supports the -B8BITMIME flag, enable the following
- #
- # set use_8bitmime
- #
- ##
- ## *** DEFAULT SETTINGS FOR THE ATTACHMENTS PATCH ***
- ##
- #
- ##
- ## Please see the manual (section "attachments") for detailed
- ## documentation of the "attachments" command.
- ##
- ## Removing a pattern from a list removes that pattern literally. It
- ## does not remove any type matching the pattern.
- ##
- ## attachments +A */.*
- ## attachments +A image/jpeg
- ## unattachments +A */.*
- ##
- ## This leaves "attached" image/jpeg files on the allowed attachments
- ## list. It does not remove all items, as you might expect, because the
- ## second */.* is not a matching expression at this time.
- ##
- ## Remember: "unattachments" only undoes what "attachments" has done!
- ## It does not trigger any matching on actual messages.
- #
- ## Qualify any MIME part with an "attachment" disposition, EXCEPT for
- ## text/x-vcard and application/pgp parts. (PGP parts are already known
- ## to mutt, and can be searched for with ~g, ~G, and ~k.)
- ##
- ## I've added x-pkcs7 to this, since it functions (for S/MIME)
- ## analogously to PGP signature attachments. S/MIME isn't supported
- ## in a stock mutt build, but we can still treat it specially here.
- ##
- attachments +A */.*
- attachments -A text/x-vcard application/pgp.*
- attachments -A application/x-pkcs7-.*
- #
- ## Discount all MIME parts with an "inline" disposition, unless they're
- ## text/plain. (Why inline a text/plain part unless it's external to the
- ## message flow?)
- ##
- attachments +I text/plain
- #
- ## These two lines make Mutt qualify MIME containers. (So, for example,
- ## a message/rfc822 forward will count as an attachment.) The first
- ## line is unnecessary if you already have "attach-allow */.*", of
- ## course. These are off by default! The MIME elements contained
- ## within a message/* or multipart/* are still examined, even if the
- ## containers themseves don't qualify.
- ##
- #attachments +A message/.* multipart/.*
- #attachments +I message/.* multipart/.*
- #
- ## You probably don't really care to know about deleted attachments.
- attachments -A message/external-body
- attachments -I message/external-body
- #
- # colors
- color normal white black
- color attachment brightyellow black
- color hdrdefault cyan black
- color indicator black cyan
- color markers brightred black
- color quoted green black
- color signature cyan black
- color status brightgreen blue
- color tilde blue black
- color tree red black
- #color header brightgreen black ^From:
- #color header brightcyan black ^To:
- #color header brightcyan black ^Reply-To:
- #color header brightcyan black ^Cc:
- #color header brightblue black ^Subject:
- #color body brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
- #color body brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+
- #
- # GnuPG configuration
- set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"
- set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f"
- set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"
- set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
- set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
- set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
- set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
- set pgp_import_command="gpg --no-verbose --import %f"
- set pgp_export_command="gpg --no-verbose --export --armor %r"
- set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs %r"
- set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons --list-keys %r"
- set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons --list-secret-keys %r"
- set pgp_good_sign="^\\[GNUPG:\\] GOODSIG"
- #
- # S/MIME configuration
- set smime_ca_location="~/.smime/ca-bundle.crt"
- set smime_certificates="~/.smime/certificates"
- set smime_keys="~/.smime/keys"
- set smime_pk7out_command="openssl smime -verify -in %f -noverify -pk7out"
- set smime_get_cert_command="openssl pkcs7 -print_certs -in %f"
- set smime_get_signer_cert_command="openssl smime -verify -in %f -noverify -signer %c -out /dev/null"
- set smime_get_cert_email_command="openssl x509 -in %f -noout -email"
- set smime_import_cert_command="smime_keys add_cert %f"
- set smime_encrypt_command="openssl smime -encrypt %a -outform DER -in %f %c"
- set smime_sign_command="openssl smime -sign -signer %c -inkey %k -passin stdin -in %f -certfile %i -outform DER"
- # This alternative command does not include the full certificates chain.
- # Be sure to understand RFC 2315 section 9.1 before using it.
- # set smime_sign_command="openssl smime -sign -signer %c -inkey %k -passin stdin -in %f -outform DER"
- set smime_decrypt_command="openssl smime -decrypt -passin stdin -inform DER -in %f -inkey %k -recip %c"
- set smime_verify_command="openssl smime -verify -inform DER -in %s %C -content %f"
- set smime_verify_opaque_command="openssl smime -verify -inform DER -in %s %C"
- #
- set mixmaster="mixmaster-filter"
- #
- # See /usr/share/doc/mutt/README.Debian for details.
- source /usr/lib/mutt/source-muttrc.d|
- #
- #以下是自定义项
- #
- #收信设置,使用fetchmail收信的时候将下面注释符号去掉半作相应修改,本次使用getmail故此处保持注释状态
- #set pop_last=yes
- #set pop_pass=【相应Gmail邮箱密码】
- #set pop_user=【邮箱账号】@gmail.com
- #set pop_host=pops://pop.gmail.com
- #
- #颜色设置
- color normal brightblue default
- color attachment blue default
- color error red white
- color status white blue
- color hdrdefault magenta default
- color indicator black cyan
- #
- #发信设置
- set sendmail="/usr/bin/msmtp"
- set use_from=yes
- set from= 我的邮箱@gmail.com
- set envelope_from=yes
- #
- #设置默认编辑器
- set editor="vim"
- #设置信箱
- set mbox="~/Mail/inbox"
- set mbox_type=Maildir
- set spoolfile="~/Mail/inboxrc"
- set postponed="~/Mail/postponed"
- set record="~/Mail/sent"
- #
- macro index G "!getmail\n" "Invoke getmail"
- macro pager G "!getmail\n" "Invoke getmail"
- #
- # 让mutt监视下面几个邮箱,并随时报告新邮件
- # mailboxes "=inbox"
- # mailboxes "=USTCstudent"
- # mailboxes "=USTCteacher"
- # mailboxes "=ustcbbs
- # mailboxes "=Gmail"
- # set check_new = yes
- # set timeout = 600
- #
- #set alternates=" usr@gmail.com"
- ## 这是一个格式字符串,用来控制你的index的列表显示。它的缺省定义是
- ## set index_format="%4C %Z %{%b %d} %-15.15L (%4l) %s"
- ##指定你有哪 些信箱文件。当你按 "c" 切换信箱时,再按 Tab 键,这些信箱就可供你选择
- mailboxes Mailbox sent-mail
- ## 这是一个 bool 型变量。它表明你在回信时引用原文是否加入原文的邮件头。
- set header=yes
- ## 可以设置为 yes, no, ask-yes, 或者 ask-no.
- ## 这是说,当你按q退出时,是否提示你(ask-yes,ask-no),
- ## 还是直接就退出了(yes),还是根本不理你(no)。
- #set quit=ask-yes
- ## 那些类型的附件是允许直接通过 .mailcap 浏览的?
- #doc类型的附件通过wvware转成html 浏览
- auto_view text/html application/msword
- ## 这也是一个提示性变量。它是确定当你退出时,是否提示你把信件
- ##从spool 移动到的mbox 文件。
- set move=no
- ## 当 Mutt 用 thread 方式显示时,是否用纯 ascii 表示树状列表。
- set ascii_chars=yes
- ## 回信时是否包含原文。
- set include
- ## 回信的引文之前插入那个符号?
- set indent_str="> "
- ## 设置你自己的邮件头。
- my_hdr From: 我想显示的邮箱@gmail.com
- ## 打分
- ## 新信件+4分,主题包含"通知"的+2,主题包含 "Circulation" +3, 已经标记
- ## 删除的 -5,上次没有读的 +1,包含 "believe"的 -10(垃圾广告!)。
- score "~N" +4
- score "~s 通知" +2
- score "~s icesx" +3
- score "~D" -5
- score "~O" +1
- score "~s believe" -10
- ## 排序方式。
- set sort=score
- ## 当用 thread 排序方式时,我们对各个 thread 的相对排序顺序。
- set sort_aux=date
- ## 如果翻到最后,再按往下翻也不会翻到下一封信件
- set pager_stop
- ## 如果设置,当你按 "r"
- ## 回信时,就不会再提示你输入回信地址和主题,直接进入编辑
- ##模式。
- set fast_reply
- ## 当你按 "t" 或者 "D" 之类的标记操作时,是否自动把光标移动到下一封信件。
- set resolve=yes
- ## 地址簿
- source ~/.mutt.alias
- ## 当你在 index 里按 "a"
- ## 为来信者取别名时,使用哪一个别名文件保存这个别名。
- set alias_file=/home/ydjx/.mutt.alias
- ## 你发出的邮件保存到那个信箱文件?比如可以像我这样每个月发出的信件放在不同的文件
- #里。
- set record="~/Mail/=sent-mail-`date +%Y-%m`"
- ## 你的终端支持哪一种编码的显示?这个必须和你的终端编码一样。
- ##注意这个如果设置不正确的话会导致在写邮件时出现一个"bad IDN"的错误信息
- set charset="utf-8"
- ## send_charset
- set send_charset="us-ascii:iso-8859-1:gb2312:utf-8"
- ## 外部程序退出时,是否要求用户按一个键才返回。这在察看某些shell命令输出时是比要>的,
- ## 否则它们一下就消失了。
- set wait_key=yes
- ## 当你要把信件存到另一个信箱,而这个信箱已经存在时,是否提示附加?
- set noconfirmappend
- ## 是否把邮件头也放在编辑器里可以修改?
- set edit_headers=no
- ## 当你在用 pager 看信件时,在 index 留出多少行显示邮件列表?
- set pager_index_lines=4
- ## 告诉 Mutt 你已经订阅了那些邮件列表(mailing-list).
- ## subscribe fvwm@fvwm.org
- ## mutt显示日期为中文
- ##set locale="zh_CN"
- set locale="UTF-8"
- ## Chinaren 等服务器发出来的信件使用了 quoted-printable 的 subject,
- ## 而且设置编码为 "iso8859-1",这显然是错误的。
- ## 对付这个错误的办法是把 iso-8859-1 变成 gb2312 的别名
- charset-hook ^iso-8859-1$ gb2312
- ## evolution 发过来的 subject 为 utf-8 编码的邮件标题乱码!
- ## 那就把不是 utf-8 的编码都映射到 gb2312
- charset-hook !utf-8 gb2312
- ##删除到Trash目录
- folder-hook . 'macro index d "~/Mail/Trash\r"'
- folder-hook ~/Mail/Trash 'bind index d delete-message'
- ##签名档
- set signature="~/Mail/.signature"
getmailrc 用来收邮件,权限要设置为700 就是只给执行权限,此文件放在了.getmail文件夹中
gmail的pop3/imap强制使用ssl连接,一般的不需要的或者不支持的就需要去掉type中的ssl
- [options]
- verbose=1
- read_all=false
- delete=false
- message_log=~/.getmail/log
- [retriever]
- type=SimplePOP3SSLRetriever
- server=pop.gmail.com
- port=995
- username=我的邮箱@gmail.com
- password=我的密码
- [destination]
- type=Maildir
- path=~/Mail/inbox/
.msmtprc 用来发送邮件,权限为600 因为这里有密码所以不允许高权限,否则会警告的
- account ShouHuXinYang
- host smtp.gmail.com
- from ShouHuXinYang@gmail.com
- auth on
- user ShouHuXinYang@gmail.com
- password 我的密码
- port 587
- tls on
- tls_starttls on
- tls_trust_file /etc/ssl/certs/ca-certificates.crt
- account default:ShouHuXinYang
证书验证文件是下载的wget
折腾这么多原理就 用各自专业的东西干各自的事情,mutt管理邮件,fetchmail getmail 用来收邮件,sendmail postfix用来发邮件
G 用来收邮件 c ? 进入邮箱邮件列表 m 发送邮件 r回复邮件 签名通讯录什么的就看配置吧
参考
http://blog.chinaunix.net/uid-20543672-id-3349607.html 参考
其实参考的比较多 我也不能都记录下来了,在此谢过那些分享人们了~~
遗留问题:我这里还有一个问题 就是如果我想根据不同的邮箱 用不同的帐户发出去 我就不知道怎么设置了,之前见过有人自己定一个宏,还说有点小问题,我也没细看,现在不知道有没有好的办法?
阅读(9879) | 评论(0) | 转发(1) |