LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2929|回复: 10

gentoo使用mutt+msmtp做为gmail 邮件客户端

[复制链接]
发表于 2008-2-6 22:47:53 | 显示全部楼层 |阅读模式
gentoo 使用mutt+msmtp来接收与发送gmail邮箱
1.mutt安装与设置
#echo "mail-client/mutt pop">/etc/portage/package.use
#emerge mutt
这样mutt就可以支持在~/.muttrc中加入pop_host变量来设置pop3,直接下载邮件而不需要安装fetchmail。
2.安装 run-mailcap
~.mailcap文件可以在mutt中根据附件文件类型来执行对应的操作
#emerge run-mailcap
使用run-maical 自动产生/etc/mailcap
######
# ~/.muttrc
######
set rfc2047_parameters=yes
set folder = ~/Mail
set mbox="~/Mail/inbox"
set postponed="~/Mail/postponed"
set spoolfile="~/Mail/inbox"
set record="~/Mail/sent"
set query_command="lbdbq '%s'"
my_hdr From:jayen<xxxxx@gmail.com>
my_hdr Reply-To:jayen<xxxxx@gmail.com>
set pop_host="pops://username:password@pop.gmail.com"  #用户名及密码
set pop_last=yes                  # 只收取新邮件,如果是第一次使用,请先注释掉此行,第一次收取邮件后在取消注释)
set sendmail = "/usr/bin/msmtp"
set envelope_from = yes
set mailcap_path="/etc/mailcap"
set mailcap_sanitize=yes

set header = no
set hostname = gmail.com
set quit = yes
set move = no
set ascii_chars = yes
set include = yes
set indent_str = " > "
set fast_reply = yes

set pager_stop = yes
set resolve = yes

source ~/.mutt.alias
set alias_file=~/.mutt.alias
set send_charset="us-ascii:iso-8859-1:gb2312:utf-8"
set wait_key = yes
set edit_headers = no
set pager_index_lines = 4
set index_format = "%Z %2C |%{%b月%d日} %-15.15L (%5lk) %s"

color normal white default
color attachment black magenta
color signature brightred default
color status white blue
color tilde blue default
color tree brightmagenta default
color underline yellow default
color bold green default
color error red default
color indicator black white
color markers brightred default
color message white blue
color body cyan default "ftp://[^ ]*"
color body cyan default "www.[^ ]*"
color body brightgreen default "[[:alnum:]][-+.#_[:alnum:]]*@[-+.[:alnum:]]*[[:alnum:]]"
color body cyan default "<URL:[^ ]*>"
color body brightblue default "(^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$)"
color body brightblue default "(^|[[:space:]])_[^[:space:]]+_([[:space:]]|$)"
color body brightblue default "(^|[[:space:]])/[^[:space:]]+/([[:space:]]|$)"
color body yellow default "[;:]-[)/(|]"
color body yellow default "[8][-\^][)|]"
color body yellow default "[;:][)/(|]"
color body brightblue default "(http|https|rsync|ftp|news|telnet|finger|gopher)://[^ ]*"
color body brightblue default "<(http|https|rsync|ftp|news|telnet|finger|gopher)://[^ ]*>"

color header yellow default "^cc: "
color header red cyan "^X-Spam-Status:"
color header green default "^date: "
color header yellow default "^from "
color header cyan default "^from: "
color header yellow default "^newsgroups: "
color header yellow default "^reply-to: "
color header cyan default "^subject: "
color header green default "^to: "
color header yellow default "^x-mailer: "
color header yellow default "^message-id:"
color header yellow default "^Organization:"
color header yellow default "^Organisation:"
color header yellow default "^User-Agent:"
color header yellow default "^message-id: .*pine"

color quoted cyan default
color quoted1 yellow default
color quoted2 red default
color quoted3 green default
color quoted4 cyan default
color quoted5 yellow default
color quoted6 red default
color quoted7 green default

color index green default ~N
color index red default ~O
color index magenta default ~F
color index blue default ~T
color index yellow default ~D

2.msmtp安装与设置
#emerge msmtp

#####
#~/.msmtprc
#####
defaults
logfile ~/logs/.msmtp.log

account gmail
host smtp.gmail.com
port 587
from xxxxx@gmail.com
tls on
tls_trust_file ~/.certs/cert.crt
auth on
user xxxxx@gmail.com
password xxxxxxxxxxxxx

account default:gmail
###
#End
#######

如果没有cert.crt文件可以在此处下载:
ftp://ftp.freebsd.org/pub/FreeBS ... ty/ca-roots-1.2.tbz


这样就可以实现基本gmail邮箱的收发功能.
发表于 2008-4-20 12:31:15 | 显示全部楼层
您好,我的设置如下,但是反送时命令

mutt -s "test" ***@yahoo.cn < music.sh

光标就在下一行一直闪,发不出去.
请问怎么办?如何解决?




~/.muttrc

set rfc2047_parameters=yes
set folder = ~/Mail
set mbox="~/Mail/inbox"
set postponed="~/Mail/postponed"
set spoolfile="~/Mail/inbox"
set record="~/Mail/sent"
set query_command="lbdbq '%s'"
my_hdr From:laoliu<m*****@gmail.com>
my_hdr Reply-To:laoliu<m*****e@gmail.com>
#set pop_host="pops://usernameassword@pop.gmail.com" #用户名及密码
#set pop_last=yes # 只收取新邮件,如果是第一次使用,请先注释掉此行,第一次收取邮件后在取消注释)
set sendmail = "/usr/bin/msmtp"
set envelope_from = yes
set mailcap_path="/etc/mailcap"
set mailcap_sanitize=yes

set header = no
set hostname = gmail.com
set quit = yes
set move = no
set ascii_chars = yes
set include = yes
set indent_str = " > "
set fast_reply = yes

set pager_stop = yes
set resolve = yes

#source ~/.mutt.alias
#set alias_file=~/.mutt.alias
set send_charset="us-ascii:iso-8859-1:gb2312:utf-8"
set wait_key = yes
set edit_headers = no
set pager_index_lines = 4
set index_format = "%Z %2C |%{%b月%d日} %-15.15L (%5lk) %s"

color normal white default
color attachment black magenta
color signature brightred default
color status white blue
color tilde blue default
color tree brightmagenta default
color underline yellow default
color bold green default
color error red default
color indicator black white
color markers brightred default
color message white blue
color body cyan default "ftp://[^ ]*"
color body cyan default "www.[^ ]*"
color body brightgreen default "[[:alnum:]][-+.#_[:alnum:]]*@[-+.[:alnum:]]*[[:alnum:]]"
color body cyan default "<URL:[^ ]*>"
color body brightblue default "(^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$)"
color body brightblue default "(^|[[:space:]])_[^[:space:]]+_([[:space:]]|$)"
color body brightblue default "(^|[[:space:]])/[^[:space:]]+/([[:space:]]|$)"
color body yellow default "[;:]-[)/(|]"
color body yellow default "[8][-\^][)|]"
color body yellow default "[;:][)/(|]"
color body brightblue default "(http|https|rsync|ftp|news|telnet|finger|gopher)://[^ ]*"
color body brightblue default "<(http|https|rsync|ftp|news|telnet|finger|gopher)://[^ ]*>"

color header yellow default "^cc: "
color header red cyan "^X-Spam-Status:"
color header green default "^date: "
color header yellow default "^from "
color header cyan default "^from: "
color header yellow default "^newsgroups: "
color header yellow default "^reply-to: "
color header cyan default "^subject: "
color header green default "^to: "
color header yellow default "^x-mailer: "
color header yellow default "^message-id:"
color header yellow default "^Organization:"
color header yellow default "^Organisation:"
color header yellow default "^User-Agent:"
color header yellow default "^message-id: .*pine"

color quoted cyan default
color quoted1 yellow default
color quoted2 red default
color quoted3 green default
color quoted4 cyan default
color quoted5 yellow default
color quoted6 red default
color quoted7 green default

color index green default ~N
color index red default ~O
color index magenta default ~F
color index blue default ~T
color index yellow default ~D

~/.msmtprc
defaults
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/Mail/msmtp.log

#gmail
account gmail
host smtp.gmail.com
port 587
from m*****@gmail.com
auth on
user m*****@gmail.com
password #####

#yahoo
account yahoo
host smtp.mail.yahoo.com.cn
from ***@yahoo.cn
auth on
user ***
password #####

account default : gmail
回复 支持 反对

使用道具 举报

发表于 2008-4-21 02:47:08 | 显示全部楼层
居然看漏了。
回复 支持 反对

使用道具 举报

发表于 2008-4-21 12:46:44 | 显示全部楼层
加精又怎样呢?实现不了就没有价值。right?
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:04:34 | 显示全部楼层
见精顶xyz
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:07:12 | 显示全部楼层
兄弟,不要这么刻薄嘛
任何一个guide howto不可能第一版就是没有任何问题的
加精就是给予原作者以鼓励,使他更有动力来完善自己的文章

至于你的问题,我实在想不到原因,你试试发到gmail里行不行。如果也不行,肯定是你的msmtp没有设置好。至于哪里出了问题。我也不确定。或者你试试这里的设定方法
http://www.gentoo-cn.org/doc/zh_cn/git-howto.xml
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:22:17 | 显示全部楼层
对不起。我实验Email炸弹2weeks。
一点东西都没出来,原理也看了很多,现在很烦。
那个git应该和目前的我没关系,其中的msmtp我也试了。但是没结果。

我有在gmail里收到no subject,no content的邮件,不知道是不是我发的,但是我发的时候都有subject和content的。
还有我的gmail联系人里居然有mathematics@debian.fly,这是我的用户名@本机域名。
我在我的debian和gentoo系统都试了,但是问题都相同。
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:27:52 | 显示全部楼层
不用问了,就是你发的
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:31:59 | 显示全部楼层
但是是空的。
我发给163yeah就什么都没有。
how,what
回复 支持 反对

使用道具 举报

发表于 2008-4-21 13:55:21 | 显示全部楼层
知道什么叫垃圾邮件么?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表