Follow dba-ninja.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

dba-ninja.com Links

Dba_db2_button

Sqlserver_dba_button

How to use an external smtp server with Linux mail \ mailx

08 January,2019 by Rambler

Question: How can I use an external smtp server with Linux mail ?   I'm using the heirloom-mailx implementation on RHEL.

Answer: Here are some examples of using an external smtp server, using the heirloom package on RHEL.

 

--sending an email to an external smtp server - with an attachment 
mail -v -r "[email protected]" -s "Test Email with attachment" -S smtp="smtp-xxxx.xxxx.xxxx.net" -a/tmp/hi_jack.txt  "[email protected]"


--sending an email to an external smtp server with multiple recipients
 
mail -v -r "[email protected]" -s "Test Email with attachment" -S smtp="smtp-xxxx.xxxx.xxxx.net" -a/tmp/hi_jack.txt  "[email protected],[email protected]"

--sending an email to an external smtp with message written to body 
echo "Hi Jack" | mail -v -r "[email protected]" -s "Test Email without attachment" -S smtp="smtp-xxxx.xxxx.xxxx.net"  "[email protected]"


Author: Rambler (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to use an external smtp server with Linux mail \ mailx


dba-ninja.com