发送邮件从Ubuntu命令

2012-11-17 阅读 43

从命令行发邮件:

<pre class="brush:bash;">    apt-get install mutt

apt-get install msmtp

```
<p>
	&nbsp;</p>
<p>
	配置:</p>
<pre class="brush:php;">    vim /etc/Muttrc

#最后加
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="dt001-78dm"
set from=proxy@huilinwang.com
set envelope_from=yes
```
<pre class="brush:php;">    vim .msmtprc

#增加
account default
host smtp.exmail.qq.com
from proxy@huilinwang.com  
auth login                           
user proxy@huilinwang.com
password proxy!@#
logfile ~/.msmtp.log

```
<p>
	&nbsp;</p>
<p>
	发送:</p>
<pre class="brush:bash;">    mutt -s 'test from dm000' t@qq.com -a 1.txt 
```

更新于 2023年03月28日