mutt + msmtp + getmail 配置备忘

80酷酷网    80kuku.com

  

  设置了用 mutt + msmtp + getmail 的组合管理邮件,将配置文件贴在这里作为备忘。

  .muttrc

set locale = zh_CN.gbk
set charset = gbk
#设置邮件储存位置
set spoolfile = ~/spool/inbox
set mbox_type = Maildir
set folder = ~/Mail
set mbox = "+inbox"
set record = "+sent"
set postponed = "+outbox"
#用msmtp发送邮件
set sendmail = "/usr/local/bin/msmtp"
set use_from = yes
# 设置用gmail帐号发信
set from = xxxxxxgmail.com
set envelope_from = yes
my_hdr From: xxxxxx<xxxxxxgmail.com>
my_hdr Reply-To: xxxxxx<xxxxxxxgmail.com>
ignore headers *
unignore headers from: to: subject date
#set hdr_order to from subject date
#设置快捷键G调用脚本 checkmail 检查新邮件
macro index G "!~/checkmail" "Checking mails......"
#处理html格式的邮件
auto_view text/html
#邮件头的颜色
color header brightred black ^from
color header brightblue black ^to
color header brightcyan black ^subject
color header brightgreen black ^date

  .mailcap

#设置用w3m显示html格式邮件
text/html; w3m %s; nametemplate=%s.html
text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput

  .msmtprc

# Set default values for all following accounts.
defaults
tls on
logfile ~/.msmtp.log
# gmail.com mail service
# 设置用gmail的smtp服务发信
account gmail
host smtp.gmail.com
from xxxxxxgmail.com
auth on
user xxxxxxgmail.com
password xxxxxx
port 587
# Set a default account
account default : gmail

  用getmail收取邮件的checkmail 脚本

#!/bin/bash
#[username]和[password]用真实的用户名和密码代替
echo -n "Checking "
echo -n "xxxxxx21cn.com "
getmail_fetch -d -q pop.21cn.com [username] [password] ~/spool/inbox
echo -n "xxxxxxtom.com "
getmail_fetch -d -q pop.tom.com [username] [password] ~/spool/inbox
echo -n "xxxxxx163.com "
getmail_fetch -d -q pop.163.com [username] [password] ~/spool/inbox
echo -n "xxxxxxgmail.com "
getmail_fetch -s -q pop.gmail.com [username] [password] ~/spool/inbox
echo "Done."


分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: