DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Wednesday, July 30, 2008

Sending Mails through Os( Unix ) with Mailx

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

Thanks & Regards,
Narasimha Rao.K