Wednesday, October 5, 2016

Unix solution : How to send a mail with subject, attachment and mail body using command ‘uuencode’

Here is the command to send a mail with Subject, Body along with Attachment.

(echo #BODY uuencode #ATTACHMENT_FILE  ‘#ATTACHMENT_FILE_NAME’ | mail –s #SUBJECT #MAIL_RECEICER  

For example-(echo $5 uuencode $4 ‘Purchase Order.pdf’) | mail -s  $1
Here
  • $5 is the parameter which contain Body part.
  • $4 is the parameter which says about the Location of file to be mailed.
  • $2 is the parameter which says about Subject
  • $1 is the mail recipient.

No comments:

Post a Comment