how to create embedded html email

I'd like to create an email with html formatting via a batch process in Linux using mailx. I can easily create an html doc using the right tags, but if I just send that as the message body I get an email showing the raw html.

How to I make it show the rendered html?
LVL 1
jmarkfoleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrej PirmanCommented:
You need to properly format message as HTML, not just send HTML instead of mail body.
Try this converter (free) and you might see the propeer encoding: http://www.neuron-webagency.com/shop/eng/convert-html-to-eml

Are you using Linux shell to batch convert?
0
Dave BaldwinFixer of ProblemsCommented:
This page http://webcheatsheet.com/PHP/send_email_text_html_attachment.php#attachment shows how to use PHP to create a complete email with both text and HTML sections that uses the proper headers to identify each part.  Also includes attachments.  Without the Content-Type headers, HTML is not recognized.
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Open in new window

0
jmarkfoleyAuthor Commented:
OK, I found 2 solutions:
$ senmail -t <<EOF
To: me@thatdomain.com
From: me@thisdomain.com
Date: Thu, 21 Aug 2014 01:14:29 -0400
Subject: test html
Content-Type: text/html

<html>
<body>
:
:
</body>
</html>
EOF

Open in new window

... of course there are lots of way to pipe into sendmail.

Solution 2:
mutt  -e 'set content_type="text/html"' me@thatdomain.com -s "test html" <my.html

Open in new window

I like the 2nd method because I don't have to specify the time (having no Time: header tends to generate spam points in spamassassin) and I don't have to specify my sender email address. Basically, it works just like mailx except that I have a -e option in mutt to set the content type whereas (after exhaustive searching of the man page) there is no such option in mailx. Also, method 2 lets me create a standalone html file with no mail headers prepended.

Andrej Pirman: Your site looked interesting, but requires one to register first -- which I'm disinclined to do -- and also says the site does not work with IE, and I didn't really feel like firing up firefox in addition to registering. Besides, all I needed is one header, which Dave Baldwin listed, but really needed to know *how* to get that into my mail client.

Other comments before closing?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmarkfoleyAuthor Commented:
I found the solution I needed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.