3

I have a command I have been using to send emails with an attachment and a message body

(cat msg_file.txt; uuencode file.csv file.csv) | mail -s "subject" [email protected]

as soon as I add the -a option for sending headers in order to send an HTML file

(cat msg_file.html; uuencode file.csv file.csv) | mail \
 -a "MIME-Version: 1.0" \
 -a "Content-type: text/html; charset=iso-8859-1" \
 -s "subject" [email protected]

The HTML file will work but now the attachment does not. Instead I get a long string of text that is mostly not human readable and isn't any help, I have no idea what it means.

I have tried variations on how I am reading the email body to stdin like

uuencode file.csv file.csv | mail \
 -a "MIME-Version: 1.0" \
 -a "Content-type: text/html; charset=iso-8859-1" \
 -s "subject" [email protected] < msg.html

But still no luck. I do not know a lot about headers so I may be over looking something to do with the headers? Does anyone know how to alter the above commands to send an attachment along with the HTML message body? Or will I have to use another method?

0

You must log in to answer this question.

Browse other questions tagged .