DOYENSYS Knowledge Portal



We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL :

Click here Navigate to 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

3 comments:

Sesha said...
This comment has been removed by the author.
Sesha said...

I believe, there is one problem sending attachments in UX... which is only text attachments are possible from command line. Is this TRUE?

Narasimha Rao said...

Hi Sesha,

We can send any format files as attachments in any unix OS.

I have tested with other format files also.

Will know if you find any issues.

Thanks & Regards,
Narasimha Rao.K