| Who here hasn't tried to create and and send an | | | | "Content-Type:" which identifies the type of content |
| HTML newsletter by email. It sounds easy enough. | | | | that is included in that email. The emails that you, me, |
| Create an html page, copy the code, paste it in email | | | | and everyone usually send are mostly text. Plain |
| and voila. Well it does, until you actually try it. | | | | Text to be exact. That's why when I tried to copy |
| For a long time, I too tried to figure out how to send | | | | and past the html source code in the past it had just |
| an html email newsletter. I tried just about every | | | | shown up as HTML. |
| way to send it. One of the ways was to save the | | | | When I saw the content type for the text emails it |
| html page and then attach it as an html file with the | | | | was: |
| email. I tried just copying the source code of the | | | | Content-Type: text/plain; |
| html file and send that in. I even tried saving the | | | | When I saw the content type for the html emails |
| webpage as an email file and that didn't work either. | | | | which displayed very nicely, it was: |
| After trying a few more ideas I decided it's best to | | | | Content-Type; text/html; |
| just use plain text until I can figure out how to send | | | | WOW. I mean I couldn't belive it that after all this |
| it correctly. | | | | time it was that one small line that had stopped me |
| As luck would have it though I did find out how to | | | | and probably countless others from successfully |
| finally send an HTML newsletter by email. I was | | | | sending html emails. |
| working on an email comments form with ColdFusion, | | | | But how would you tag your email as html? |
| a web programming language, one of features | | | | It depends on how you're sending it. |
| included sending data in HTML format. I thought why | | | | If you plan on sending your html email newsletter |
| not try it, it might just work. So I copied the code of | | | | with a web programming language, such as Cold |
| an html webpage and then emailed it to myself, and | | | | Fusion then you can use cfmail's type="HTML" |
| voila. | | | | feature, which will automatically set the |
| But had I really figured it out though? There had to | | | | Content-Type to text/html and display the email as |
| be something else in the code which ColdFusion | | | | an HTML Newsletter. |
| added that allowed the newsletter to display | | | | If you plan on sending it with ASP.NET, then the |
| correctly. I looked at the html code for the email and | | | | below line should clear it up: |
| there was nothing different about this email. It was | | | | YourMessageName.BodyFormat = MailFormat.Html |
| the same code as all the other html newsletters that | | | | Or if you plan on using PHP then it should look |
| I had tried and tested in the past. Except that this | | | | something like this |
| one displayed correctly and the others didn't. Odd. | | | | "To: The Receivers Name \n" . |
| Why didn't the newsletter work when I tried to | | | | "From: The Senders Name \n" . |
| copy, paste and email it. It's the same email and the | | | | "MIME-Version: 1.0\n" . |
| same code so it should work just as fine. Something | | | | "Content-type: text/html; charset=UTF-8"); |
| was missing. | | | | Most, if not all web programming language include a |
| A couple of days later I went back to look at the | | | | feature which allows you to send html data. |
| code for the email thinking that maybe I had | | | | Tip: Make sure the code or software that you use to |
| overlooked something. The source code was still the | | | | send email has support for MIME, which allows you to |
| same, nothing had changed. So what could it be? | | | | send non text emails, HTML etx. |
| That's when I stumbled on to a small line that would | | | | So now you know the secret. It's not the code, it's |
| change everything. | | | | the email's content type which decides how to |
| The line I'm talking about is the content-type, which | | | | display your HTML email newsletter. Now that you |
| is part of every email's header file. I'd read about | | | | know how to send HTML email, make sure to test |
| content type, but most of it had to do with XHTML | | | | your newsletters with different email accounts |
| webpages. After a little bit of research here's what I | | | | (Yahoo, Hotmail, Google, etx). Each one of them |
| discovered: | | | | tends to display your HTML differently. Test, Test, |
| Every email has a property known as: | | | | and Retest. |