遵命女王陛下2:mutt usage

来源:百度文库 编辑:九乡新闻网 时间:2024/07/14 02:58:45
/toolsusage/
mutt
1: 浏览符合限定条件的邮件
    L   ~h  .*<030.*@stu.*   设定对邮件头部的匹配模式(egrep模式)
        ~b  ..............   设定对信件内容的匹配模式
        ~F                      匹配设定为重要标记的邮件
        ~T           tagged messages
    更多关于pattern的信息见/usr/share/doc/mutt/html/index.html中的
    file:///usr/share/doc/mutt/html/advancedusage.html#patterns
2:    F   设定邮件的重要标记
    T   标记符合某些pattern的邮件
    D    DELETE PATTERN
    U    UNDELETE PATTERN
    ^U    undelete all messages in thread
    T    tag messages matching a pattern
    ^T    untag messages matching a pattern
3: 关联两个邮件,使他们具有thread关系
   t    标记当前的邮件,将是parent
   &    移动到要关联的邮件,按下&来和标记的邮件关联
4: y    选择本地邮箱(如mbox)进入 
5: man muttrc
    man mutt
    zless /usr/share/doc/mutt/manual.txt.gz
    /usr/share/doc/mutt/html/index.html
6: To forward a single attachment:

    1. Select the letter to forward, press v (view).
    2. Select the attachment from the list, press f (forward).
    3. Compose and send the mail as usual!

   To forward multiple attachments:

    1. Select the letter to forward, press v (view).
    2. Tag all attachments you want to forward with t (tag).
    3. Press ; and f (forward).
    4. Compose and send the mail as usual! 

    !(~t mutt|~c mutt) ~f elkins
    '~s "^Junk +From +Me$" ~f ("Jim +Somebody"|"Ed +SomeoneElse")'
    ~f "me@(mutt\.org|cs\.hmc\.edu)"
    ~d 20/1/95-31/10
    ~d 15/1/2001*2w
    ~d <1m     <>=
7: esmtp for gmail

 Gmail

First edit your ~/.esmtprc according to http://mail.google.com/support/bin/answer.py?answer=13287. It should look like this:

identity username@gmail.com
        hostname smtp.gmail.com:587
        username "username@gmail.com"
        password "password"
        starttls required

Since Gmail requires the use of the StartTLS extension, you'll need to add the Cert-Authority (CA) root certificate which signed Gmail server certificate.

Gmail's server certificated is signed by Thawte. You can either follow the instructions to use Mozilla's CA cert bundle, found elsewhere in this document, or download directly the Thawte Premium Server CA certificate, as shown below:

mkdir ~/.authenticate
chmod 0700 ~/.authenticate
wget https://www.verisign.com/support/thawte-roots.zip

msmtp:
account gmail
host smtp.gmail.com
port 587
from dongtao.cn@gmail.com
auth on
tls on
protocol smtp
user dongtao.cn@gmail.com
password 12345678
tls_trust_file /home/f/.authenticate/ThawtePremiumServerCA_b64.txt

fetchmail:
 openssl s_client -connect pop.gmail.com:995 -showcerts
 Next, you need to copy the certificate part, which is everything between the "BEGIN CERTIFICATE" part and "END CERTIFICATE" part, and save this to a file.

   echo '-----BEGIN CERTIFICATE-----
    MIIC3TCCAkagAwIBAgIDBZIAMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
    MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
    ...
    -----BEGIN CERTIFICATE----- ' > ~/.authenticate/googlepop.pem

echo 'Equifax Secure CA
=================
MD5 Fingerprint: 67:CB

另外我在《GNU/Linux下Gmail的mutt+msmtp+getmail解决方案》里面提到“.mailcap”文件中设置html邮件用lynx查看,但是在使用的过程中发现凡是查看html的时候几乎都是乱码,可能跟我收信来源比较单一有关吧。

修改了一下该文件,使用w3m查看html邮件:

application/msword; wvHtml –charset=gb2312 %s - | lynx –dump -stdin;nametemplate=%s.html; copiousoutput
text/html; w3m -dump -I GBK %s; nametemplate=%s.html; copiousoutput

即将最下面一行中的lynx换成w3m,并且加上“-I GBK”的选项,w3m是一个文字界面的网络浏览器,一般Linux发行版中都默认安装,如果没有就安装一个吧。-I是w3m选择网页文件编码的参数,后面跟的GBK是汉字的国标编码,我收到的html信件一般都是GBK编码的,如果不设定编码会在查看的时候出现乱码。但是收到别的编码的信件时就会出问题,因为这里设定以GBK编码解码网页了,如果是别的编码的邮件比如UTF-8,就会出现乱码,不知道怎样设置才可以使w3m自动检查网页编码。如果收到其它编码的邮件用该编码替换GBK也是可行的,但是不能每次收到不同编码的邮件就去修改.mailcap文件吧。还是选择最常用的编码填上算了,如果收到别的编码的邮件,就把附件中的该网页保存下来用Firefox或者Opera看。

xlassie:  mail notifier 
xlassie -hilight -update 60 -shape -mailcommand "gnome-terminal -e mutt"

wvText can translate doc type file to text type file with the help of elinks


在mutt中清除某些信件的标记:
    1: 按下shift_t,然后输入条件(如~N代表新邮件~O代表旧的但还未看或者正则表达式).
    2: 符合条件的信件会被标记为*, 按下分号(;)会提示如何来处理这些被标记的信件 
    3: 按下shift_w, 输入取消的标记.

在转发时, 要想把多个附件也转发出去需要下面的方法:
    1: 在浏览信件的页面按下v, 进入附件查看页面.
    2: 按下t, 标记要转发附件.
    3: 按下分号(;)再按下f进行转发.

所收附件的中文名称为乱码的问题
    由于大部分email客户端采用非标准的RFC2047格式作为附件名称的编码,而mutt采用标准的RFC2231对附件文件名进行编码。解决办法是确认在$HOME/.muttrc中存在以下内容。
    set rfc2047_parameters=yes
别HTML邮件内容为乱码的问题
    如果你在$HOME/.muttrc中添加了"auto_view text/html",那么可能有个别HTML格式的邮件存在乱码问题。这种情况很可能发生在当你的编码环境是UTF-8,而那些HTML邮件的编码格式是gbk。对于这种在mutt中显示为乱码,但在浏览器中却可以正常显示的问题,请确认在$HOME/.mailcap中存在以下内容,如没有此文件则手工创建。

    text/html ;\
    w3m -T text/html -I %{charset} -dump %s ;\
    nametemplate=%s.html ;\
    copiousoutput

使用通讯录
    mutt支持通讯录,包括把发件人自动添加到通讯录,以及在撰写邮件时列出通讯录中的对象两项功能。确认在$HOME/.muttrc中存在以下内容

    # 在mutt提示To:时,按tab显示通讯录
    source ~/.abc.alias
    # 在mutt按a,把发件人添加到通讯录
    set alias_file=~/.abc.alias