Search code examples
amazon-ec2mutt

Syntax issue with sending email via mutt on EC2


I'm trying to send an email from my Amazon EC2 node using mutt and I'm getting an error that I'm assuming is syntax but I can't see what I'm doing wrong. I'm trying to send an email with a txt attachment

echo "Sending Test" | mutt -a test.txt -s "test email" name@emaildomain.com

However I get the following errors:

Can't stat name@emaildomain.com: No such file or directory
name@emaildomain.com: unable to attach file

It is clearly trying to attach a file that is the name of the email but I don't understand why. Any help would be greatly appreciated


Solution

  • In recent versions of mutt the -a option is designed to allow multiple arguments so that you can do -a *.txt to attach any number of files which match that pattern. Because of this it must be the last option used and separated from the recipients by --:

    echo Sending Test | mutt -s "test email" -a test.txt -- name@example.com