# mutt邮箱

虽然说安卓手机里的邮箱客户端很多，好像终端邮箱也没有什么意义。但是需要批量发邮件的时候也是有一点用的。

```
pkg install mutt

# 发邮件
pkg install msmtp

# 终端浏览器
pkg install w3m
```

mutt配置文件.muttrc，以配置阿里邮箱为例:

```
set use_from=yes
set envelope_from=yes
set move=no
set include
set pager_stop
set pager_index_lines=4
set sort=reverse-date-received
set smart_wrap
set nomarkers
set mime_forward
set copy
#set beep_new=yes

set charset="utf-8"
set send_charset = "utf-8"
charset-hook !utf-8 gb2312
set assumed_charset="utf-8:gb2312:gb18030:gbk"
charset-hook ^us-ascii$ gb2312
charset-hook ^iso-8859-1$ gb2312
set rfc2047_parameters=yes

set from = "xxxxx@aliyun.com"
set realname = "zsxwz"

set imap_user = "xxxxx@aliyun.com"
set imap_pass = "xxxx"

set sendmail = "/data/data/com.termux/files/usr/bin/msmtp"
set use_from = yes
set envelope_from = yes

set folder = "imaps://imap.aliyun.com:993"
set spoolfile = "+INBOX"
set postponed ="+[Gmail]/Drafts"
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates

auto_view text/html
alternative_order text/plain text/enriched text/html
```

配置发件.msmtprc:

```
account default
host smtp.aliyun.com
port 465
tls on
tls_starttls off
auth login
user xxxx@aliyun.com
password xxxxxxx
from xxxx@aliyun.com
tls_certcheck off
```

配置浏览器.mailcap:

```
text/html; w3m -dump -I $(echo %{charset} | sed s/gb2312/gbk/I) %s; nametemplate=%s.html; copiousoutput
```

使用shell发送邮件：

```
mutt -s "来自mutt的测试邮件" xxxx@qq.com <1.txt
# -s添加标题 ,<1.txt，正文内容来自1.txt
```

termux只是一个终端模拟器，linux玩法会更多一点，可以参考:

[Linux/Mac邮件客户端mutt添加谷歌gmail/微软outlook邮箱](https://zsxwz.com/2020/09/03/linux-mac%e9%82%ae%e4%bb%b6%e5%ae%a2%e6%88%b7%e7%ab%afmutt%e6%b7%bb%e5%8a%a0%e8%b0%b7%e6%ad%8cgmail-outlook%e9%82%ae%e7%ae%b1/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://termux-wiki.zsxwz.com/mutt-you-xiang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
