需要的程序
mutt ? ? ? ? ?郵件客戶端主體,也也可以使用mail.
msmtp ? ? ?發(fā)郵件
getmail ? ? 收郵件
apt install mutt ? mail
apt install msmtp
apt install getmail
mutt的配置文件
none@none-Aspire-EK-571G:~$ cat .muttrc
mailboxes = "~/163/"? ? ? 這里的配置和getmail有關(guān)
set sendmail="/usr/bin/msmtp" ? 配置發(fā)件服務(wù)器
getmail配置文件
none@none-Aspire-EK-571G:~$ cat .getmail/getmailrc
[retriever]
type = SimplePOP3SSLRetriever
server = pop.163.com
username = abc@163.com
port = 995
password = xxxxx
[destination]
type = Maildir
path = ~/163/ ? ? ? ? ? ? ? ?要在這里創(chuàng)建一個文件 ?--這里是收到文件存放的地發(fā)
msmtp的文件配置
none@none-Aspire-EK-571G:~$ cat .msmtprc
account default
host smtp.163.com
user abc
from abc@163.com
password xxxxx
auth login
tls off
logfile ~/.msmtp.log
使用方法
發(fā)郵件
~$ echo "測試" ?| ?mutt ?-s ?"標(biāo)題" ? ?1234321@qq.com ? ?-a ? ?/home/none/aaa.tar.gz
echo 后面是內(nèi)容
-s ?標(biāo)題
-s后面是收件地址
-a 附件
收郵件
~$ mutt -y ? 或者 ?$ mail -f ./163