[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to create embedded html email

Posted on 2014-08-20
4
Medium Priority
?
352 Views
Last Modified: 2014-08-27
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?
0
Comment
Question by:jmarkfoley
  • 2
4 Comments
 
LVL 18

Assisted Solution

by:Andrej Pirman
Andrej Pirman earned 1000 total points
ID: 40275110
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
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1000 total points
ID: 40275224
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
 
LVL 1

Accepted Solution

by:
jmarkfoley earned 0 total points
ID: 40275472
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
 
LVL 1

Author Closing Comment

by:jmarkfoley
ID: 40287417
I found the solution I needed.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month19 days, left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question