send email from shell command line
1. Send an email through one command line.
echo "hello" | sendmail -f from@gmail.com -t to@yahoo.com.com
2. Send an email through command line.
sendmail -t to@gmail.com,to@yahoo.com
After the above command, enther these 3 lines and then press Ctrl-d
From:from@outlook.com Subject:test sendmail This is an email sent through the sendmail command
3. The content of the email is in the mail.txt which has the from, subject and message.
From: peng.ye@bookspan.com Subject: test sendmail This is a test email using sendmail
The above email content can be sent by this command on the command line.
sendmail -t to@gmail.com < mail.txt
4. Send an email with attachement. The command line tool uuencode needs to be installed to use sendmail to send an email with attachment.
uuencode attachment.txt attachment.txt | sendmail -f from@gmail.com -t to@outlook.com,to@yahoo.com
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts