Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mail: Invalid header when sending mail attachment with Ubuntu

This exact question was posted by user 'anvd' on 29th July but then removed - I found it on Google Cached version...!

I'm guessing the fix was something obvious, but would be great if it wasn't removed.

I am trying this command to send an email with an attachment.

echo 'These are contents of my daily backup' | mail -s 'Daily backup' -a /tmp/filename.gz [email protected]

The error: mail: Invalid header: /tmp/filename.gz

The email gets sent, but the attachment is not attached.

This used to work, and still dos on other systems, but not sure what has changed on one of my machines...

like image 832
user246977 Avatar asked Aug 04 '16 00:08

user246977


1 Answers

I just had this problem. It turns out that -a is the flag for appending headers, whereas -A is the flag for attaching files.

like image 92
Kyle_S-C Avatar answered Sep 16 '22 12:09

Kyle_S-C