mutt + getmail + msmtp + procmail配置

offlineimap 下载IMAP协议的邮件(Mutt内置的IMAP协议无法下载)
getmail     下载POP3协议的邮件
procmail    过滤邮件
msmtp       发送邮件

安装:


apt-get install mutt offlineimap getmail4 procmail msmtp



修改配置文件 ~/.muttrc

set mbox_type=Maildir
set folder=$HOME/.mail
set spoolfile=~/.mail/
set header_cache=~/.mail/.hcache

spoolfile里要有cur,new和tmp三个文件夹。

$ mkdir -p ~/.mail/{cur,new,tmp}

这是一个最精简的配置文件,能让你访问你的Maildir,并在收件箱(INBOX)中检查新Email。

spoolfile告诉Mutt从本地哪个目录来得到新Email。这里我们改到用户目录下。你还可以添加更多的Spoolfiles,例如邮件列表所在的目录。

创建一个文件~/.offlineimaprc

[general]
accounts = myaccount # change to whatever you want
ui = Curses.Blinkenlights # Gives you a nice blinky output on the console so you know what's happening.
# ui = Noninteractive.Quiet # If uncommented, this would show nothing at all. Great for cronjobs or background-processes

[Account myaccount]
localrepository = mylocal # Profile-Name for the local Mails for a given Account
remoterepository = myremote # Profile-Name for the remote Mails for a given Account
autorefresh = 5 # fetches your mails every 5 Minutes

[Repository mylocal]
type = Maildir # Way of storing Mails locally. Only Maildir is currently supported
localfolders = ~/Mail # Place where the synced Mails should be

[Repository myremote]
type = IMAP # Type of remote Mailbox. Only IMAP is supported right now.
remotehost = imap.myhost.com # Where to connect
ssl = yes # Whether to use SSL or not
# remoteport = 993 # Would specify a port if uncommented. That way, it just tries to use a default-port
remoteuser = myremoteusername # Login-Name
remotepass = myremotepassword # Login-Password. -- ACHTUNG! Of course, this is not too safe. Make sure that the file is readable only by you. Even better: use some of the suggestions in the OfflineIMAP-Manual to make it safer.
编辑~/.getmail/getmailrc
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = [email protected]
port = 995
password = password

[destination]
type = Maildir
path = ~/.mail/inbox/

现在可以运行getmail了。如果它正常工作,可以为getmail创建一个计划任务Cron,让它每隔一段时间就运行一次。 此设置可以每隔三十分钟,运行一次getmail。

$ crontab -e
$ */30 * * * * /usr/bin/getmail


用编辑器打开~/.msmtprc
# Accounts will inherit settings from this section
defaults
auth             on
tls              on
tls_trust_file   /usr/share/ca-certificates/mozilla/Thawte_Premium_Server_CA.crt

# A first gmail address
account        gmail
host           smtp.gmail.com
port           587
from           [email protected]
user           [email protected]
password       password
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# A second gmail address
account    gmail2 : gmail
from       [email protected]
user       [email protected]
password   password2 

以上为不加过滤的最简单配置。

编辑.procmailrc配置,另外需更改.getmailrc中的

[destination]
type = MDA_external
path = /usr/bin/procmail



mutt的配置就是坑爹啊,收件箱发件箱那几个目录配置至今没明白

一些参考:

http://dreamland.blog.51cto.com/417830/87510

http://www.linuxsir.org/bbs/thread373886.html


具体参见archlinux wiki


你可能感兴趣的:(mail,Mutt)