I have been using mutt for some to time to send plain text emails with a pdf attachment using:
mutt -s "Subject" -a file.pdf < mybody.txt
and html emails without an attachment using:
mutt -e "my_hdr Content-Type: text/html" -s "Subject" < mybody.html
but I now want send an html email with a pdf attachment and:
mutt -e "my_hdr Content-Type: text/html" -s "Subject" -a file.pdf < mybody.html
does not work.
Both the html and encoded pdf along with their headers show as plain text in the body of the email.
Anyone know how to do this?
Cheers
Gary
By Caleb Roger Davis
Mutt Version: 1.5.21
With some research and help with from a co-worker, I was able to get this to work ( send html file as body & pdf attachment ).
I have the .html file & .pdf as separate files. I do some keyword substitution in the .html file (replacing customer name etc) before sending.
Here is the bash script that works.
I think I could get this to work with sendmail as well if anyone is interested.
#!/bin/bash
START=`date`
# --------------------------------------------------------------------------------------
# can be comma delimited list of email addresses
[email protected]
[email protected]
subject="Monthly PDF report"
attachments="../src/test/resources/my.pdf ../src/test/resources/my2.pdf"
html_file="../src/main/resources/email_template.html"
# --------------------------------------------------------------------------------------
# send html with pdf attachment
# You can send additional attachments, the attachment list can be terminated with the "--"
mutt -e "set content_type=text/html" -s "$subject" $TO -a $attachments -- < $html_file
END=`date`
echo "START=$START"
echo "END=$END"