Sending Mails through Os( Unix ) with Mailx
Introduction
Steps to send mail through unix with mailx
Posted by Narasimha Rao
Dear All,
This Post is relating to Useful Operating system techniques
to send mails using command : Mailx
1. To send mails with body and without attachments
syntax : cat <`file’s full path and name`> mailx -s “<`Subject`>” <`Recipient`>
Example:
cat /home/myname/logs/mylog1.log mailx -s “Test Alert 1” xyz@gmail.com
2. To Send Mails without body and with attachments
syntax :
uuencode <`file’s full path and name`> <`file’s alias name`> mailx -s “<`Subject`>” <`Recipient`>
Example :
uuencode /home/myname/logs/mylog1.log alert1.log mailx -s “Test Alert 2” xyz@gmail.com
3. To Send Mails with body and attachments
syntax :
( cat <`file’s full path and name`> ; uuencode <`file’s full path and name`> <`file’s alias name`> )
mailx -s “<`Subject`>” <`Recipient`>
Example :
( cat /home/myname/logs/mylog1.log ; uuencode /home/myname/logs/mylog1.log alert1.log )
mailx -s “Test Alert 3” xyz@gmail.com