2013年5月25日 星期六

[mail command] How to use mail command to send E-mail


[mail command] How to use mail command to send E-mail



1. sudo apt-get install ssmtp



2. sudo vim /etc/ssmtp/ssmtp.conf



root=<Empty>

mailhub=smtp.gmail.com:587  <-- No Set this option. Mail can be send.



AuthUser=<UserName>

AuthPass=<UserName-Password>

UseTLS=YES

UseSTARTTLS=YES



rewriteDomain=gmail.com



hostname=<Empty>



FromLineOverride=YES



3. Test

mail -s "test mail" <UserName>@gmail.com < XXX.txt

or

echo "This is a test mail." | mail -s "test mail" <UserName>@gmail.com

or



This command can send mail include the file.



c.txt <-- This is the content of E-mail.

mpack -s happy -d ./c.txt  ./a.txt  luke_fang@unihancorp.com 



If don't want any content in the E-mail

mpack -s happy ./a.txt  luke_fang@unihancorp.com



Reference :



Related Posts:

0 意見:

張貼留言