Ubuntu uses mutt to receive, send and reply mail (mutt+msmtp+fetchmail+procmail

Ubuntu uses mutt to receive, send and reply mail (mutt+msmtp+fetchmail+procmail):

Description:
Mutt is a text-based mail client and plays the role of mail user agent. The function of msmtp is to send emails (including replies), the function of fetchmail is to save emails to the local mailbox, and the function of procmail is to filter emails (according to the sending Sort, categorize, organize emails by person, subject, keyword, etc.).

软件安装:
$ sudo apt-get install mutt
$ sudo apt-get install msmtp
$ sudo apt-get install fetchmail
$ sudo apt-get install procmail

Mutt配置:
$ cp –rv /etc/Muttrc ~/.muttrc
$ vi ~/.muttrc
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="zhi.yang"
set [email protected]
set envelope_from=yes
:wq

Msmtp configuration:
$ vi ~/.msmtprc
account default
host smtp.ming.com
port 587
from [email protected]
user [email protected]
password xxxxx
auth ntlm (auth mode depends on the support of the mailbox server )
tls off
logfile ~/.msmtp.log
:wq

$ msmtp --host=smtp.ming.com --port 587 --serverinfo (check the auth mode supported by the mailbox server)

Fetchmail配置:
$ cp –rv /usr/share/doc/fetchmail/examples/fetchmailrc.example ~/.fetchmailrc
$ vi ~/.fetchmailrc
poll smtp.ming.com with protocol pop3
username "[email protected]"
password "xxxxxx"
mda "/usr/bin/procmail -d %T"
no keep
:wq

Procmail配置:
$ vi ~/.procmailrc
VERBOSE=yes
DEFAULT=/var/spool/mail/aa
MAILDIR=$HOME/Mail
LOGFILE=$HOME/.procmail.log
:wq

$ sudo touch /var/spool/mail/aa (the aa here is freely written and can be defined by yourself)
$ sudo chown zhi.yang /var/spool/mail/aa

Use:
$ fetchmail –v (for mail synchronization)
$ mutt (you can see the inbox mail)
q: quit, r: reply (follow the prompts)

Send 1 person:
$ echo "hello" | mutt -s "title" [email protected]
$ mutt -s "title" [email protected] < ~/aa.txt

Send multiple people:
$ echo “hello” | mutt -s “title” [email protected] [email protected]

CC email:
$ echo “hello” | mutt -s “title” [email protected] -c [email protected]

Bcc email:
$ echo “hello” | mutt -s “title” [email protected] -b [email protected]

Send attachment:
$ echo “hello” | mutt -s “title” [email protected] -a ~/aa.txt

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324893918&siteId=291194637
Recommended