Wednesday, April 13, 2011

Linux send mail attachements

Whats are the possible ways to send and email attachment - say needed to embedded in a script or something. May be attachment of the error/debug logs, that your script generated.

Well i can think of -

  • mutt -s "demo email attachement" -a cvs6bld.php debajitkataki@gmail.com < body.txt
  • uuencode bgraph.php | mail -s "demo email attachement" debajitkataki@gmail.com < body.txt
Note: uuencode is a utility which come with sharutils rpm package.
  • mailx -s "demo email attachement" debajitkataki@gmail.com < cvs6bld.php

However the one with mailx command, is NOT a mime attachment - it's just your file content mixed in to the mail message body. Some e-mail clients will see it and might treat it as a real attachment, so we might be good.

Comments below are welcome- if you have tried some other raw way! :-)



Enjoy!
DK

No comments:

Post a Comment

AWS re:Invent summary 2017

As you might know, this year’s AWS re:Invent was held @ Las Vegas 11/27 – 12/1.   Below links could be a good start to explore all ...