Send mail from command line with external smtp server on ubuntu

install heirloom-mailx

 

$ sudo apt-get install heirloom-mailx

 

 

send an email with an external smtp server

 

with ssl

echo “This is the message body and contains the message” | mailx -v -r “[email protected]” -s “This is the subject” -S smtp=”mail.example.com:587″ -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user=”[email protected]” -S smtp-auth-password=”abc123″ -S ssl-verify=ignore [email protected]

without ssl

echo “This is the message body and contains the message” | mailx -v -r “[email protected]” -s “This is the subject” -S smtp=”mailxx.heteml.jp:587″ -S smtp-auth=login -S smtp-auth-user=”[email protected]” -S smtp-auth-password=”password” -S ssl-verify=ignore [email protected]

 

Leave a Reply