Monday, April 02, 2007

Send Attachments with Mutt

Use mutt to send an email through shell.
-a flag to attach an attachment
-s flag is the subject
echo -e creates the message in the body

#!/bin/bash
echo -e "This is the body message of the email" | mutt -a attachment.zip foo@recipient.com -s "This is the email subject"

1 comment:

Andrea Gelmini said...

Hi,
with modern releases of Mutt you have to put attachments at the end, or use "--" after them:

echo -e "ciao" | mutt recipient@example.com -s "Subject" -a file_to_attach

Thanks,
Andrea