Spedire un messaggio email con attachment da commandline

From RVM Wiki
Revision as of 17:53, 8 October 2005 by Gabriele.vivinetto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Spedire un messaggio text only

echo "This is the message body" | mail -s "This is the Subject" recipient@company.com


Spedire un messaggio text only su più righe

mail -s "This is the Subject" recipient@company.com  <<-END
     This is the message body.
     It can easily accommodate several lines.
     and ${substitutions} work in the here-document.
END


Diagnostica

Per vedere cosa succede:

mail -v .....

Spedire un messaggio con un attachment

echo "Here is the report I promissed: " | uuencode -m -p Attachment.doc | mail -s "This message has an attachment" recipient@company.com

Oppure

(echo "Here is the report I promissed: " | uuencode -m  Attachment.doc Attachment.doc ) | \
mail -s "This message has an attachment" recipient@company.com

Note Attachment.doc as two arguments to uuencode - once as the input file - once as the target filename.

Utilizzo di Mutt

Vedi l'ottimo articolo Sending files as mail attachments

mutt -s "Birthday celebration" -a citymap.jpg all@friends.org \
   	< invitation.txt

Sending files as mail attachments

Expert Exchange: Mail using bash script