The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,702 other followers

Linux/bash: using mutt to send a file as an email attachment (via: Stack Overflow)

Posted by jpluimers on 2014/08/21

Just in case I need this again:

None of the mutt ones worked for me. It was thinking the email address was part of the attachemnt. Had to do:

echo “This is the message body” | mutt -a “/path/to/file.to.attach” -s “subject of message” — recipient@domain.com

Thanks Alexander Bird for noticing the double-dash, rynop for the modified answer and Chris N for the original answer.

From mutt(1): Mutt Mail User Agent – Linux man page:

mutt – The Mutt Mail User Agent

Synopsis

mutt [-nx] [-e cmd] [-F file] [-H file] [-i file] [-s subj] [-b addr] [-c addr] [-a file […] –] addr […]

mutt [-nx] [-e cmd] [-F file] [-s subj] [-b addr] [-c addr] [-a file […] –] addr […] < message

Options

-a file […]

Attach a file to your message using MIME. When attaching single or multiple files, separating filenames and recipient addresses with “–” is mandatory, e.g. mutt -a image.jpg — addr1 or mutt -a img.jpg *.png — addr1 addr2. The -a option must be placed at the end of command line options.

Well, it seems the -a does not need to be at the end, but the — must be there.

–jeroen

via: bash – How do I send a file as an email attachment using Linux command line? – Stack Overflow.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: