*

2006 / June 14th/ Testing HTML Emailers

Recently I had a need to send out HTML Emails for testing without the aid of a email management app (as I’ve done in the past). As I stared at Outlook for far too long, I found out that there’s no way send an HTML email using source code.

Lame.

Luckily, I realized that some quick scripting could fix that and I whipped up a nice little php file that lets you send an HTML email to any number of email addresses through a nice little page. Upload this to your server, paste in your source code — and bam! You’re good to start testing your email in all the wonderful clients of the world.

A word from the sponsors. Advertise with Warpspire

23 Comments

comments feed

  1. Gravatar
    John

    June 15th | #

    Kyle, Awesome code… and thanks!

    Thought you might also like to know that in a bind, you can send HTML e’mails from source using Outlook Express. PC only of course ;)

    http://johnself.com/2006/06/15/outlook-express-and-html-email/

  2. Gravatar
    Joni

    June 15th | #

    What about a version for ASP?

  3. Gravatar
    Dominik Lenk

    June 15th | #

    Can’t you use Apple Mail on the Mac to send HTML emails? Just upload the page/email to your server, as you would with a normal site, then visit it with Safari. In the File menu select ‘Mail Contents of this page’…. Mail should open with everything in there. Whether it links to the images on the server or actually sends them with the message, I do not know.

    Nice idea though with the PHP script though… this is really helpful for those that do not use Expression Engine or something similar to keep their site up to date..

  4. Gravatar
    Darren Nicholls

    June 15th | #

    Nice idea & very handy. Came at a good time when i needed to test a HTML email. Ta very much.

    Keep up the good work :0

    Darren

  5. Gravatar
    Justin Perkins

    June 15th | #

    What about a version for ASP?

    It wouldn’t be nice and little.

  6. Gravatar
    AURUM3

    June 15th | #

    You can easily test your HTML email by using Mozilla Thunderbird.

  7. Gravatar
    Uncle Bob

    June 15th | #

    How can I replace the From: section with my true email address instead of the server address? Because when people click reply, I want to be able to receive it.
    The script is great.. Thanks

  8. Gravatar
    MS

    June 16th | #

    ISO-8859-1 ?? I suggest UTF-8 instead (there is a lot of “non-english-writing” people on this planet ;))

    BTW: in many applications very good choice is PHPMailer - http://phpmailer.sourceforge.net/

  9. Gravatar
    Miro

    June 16th | #

    This script is buggy and highly spam vulnerable!
    If I write something like this my boss will fire me :)

  10. Gravatar
    Andy

    June 16th | #

    oohhh dude, your timing is awesome… I was going to be researching something similar over the next couple of days! Thanks, I owe you one!

  11. Gravatar
    Jon K.

    June 16th | #

    Amazingly unimpressive. This wheel has been invented 18 trillion times before. Welcome to the internet. Sorry, it just irks me when I follow a link to something “new and exciting” that is neither-nor.

  12. Gravatar
    Sean O

    June 16th | #

    Agreed.

    This is OK for quick & dirty internal use. But don’t think about publishing this on a public web server. Bugs, Spam, SQL injection… it all can be yours!

  13. Gravatar
    Kyle

    June 16th | #

    This is OK for quick & dirty internal use. But don’t think about publishing this on a public web server. Bugs, Spam, SQL injection… it all can be yours!

    If you can perform an SQL injection on this script without modifying it’s source code, I will give you $100 million dollars. Flat out.

  14. Gravatar
    Matthew Pennell

    June 16th | #

    Campaign Monitor provides this service as well (as I found out when I developed exactly the same thing before asking anyone if it already existed…) ;)

  15. Gravatar
    Derick

    June 17th | #

    If you can perform an SQL injection on this script without modifying it’s source code, I will give you $100 million dollars. Flat out.

    Hah, that’s cheating! There aren’t any SQL involved at all! :D

  16. Gravatar
    Phil Burress

    June 18th | #

    I wouldn’t use a script like this, spammers will find it and abuse it to no end.

  17. Gravatar
    Mark Bowen

    June 19th | #

    Hi there,

    Just came across your website by having visited the http://shopify.com site and seeing your template there. Very nice!

    This site is also very very good. Fantastic design.

    Just thought I would let you know that there is a way to send HTML email from Outlook and Entourage.

    Links to two that I found on the net. There were more but I downloaded them quite a while ago but due to using Mail nowadays unfortunately do not have them anymore or links to them. I haven’t actually tried these scripts out but they are from the same site that I originally found a script for both Outlook (OS9 - OSX) and Entourage (OSX) from.

    http://scriptbuilders.net/files/sendcomplexhtmlx2.0.4.html
    http://scriptbuilders.net/files/entouragebulkmailerexample1.0.html

    Nowadays due to using Mail though the easiest thing to do is to just visit the page that you want to send by using Safari (There are a couple of other browsers that allow sending the page, I think one is called Shiira?)

    You then just go to :

    File -> Mail Contents Of This Page

    and it will add the page into a Mail email. Doesn’t always work 100% but that is due to the way that the page has been coded. Most will work pretty well though.

    Best wishes,

    Mark Bowen

  18. Gravatar
    Dan

    June 21st | #

    This is not new.
    This is not exciting.
    This is not even good.
    If you are using PHP and don’t know how to send an HTML email and would spend more than 15 seconds researching it you should leave the Internet. Forever.
    Serach for “Sending HTML emails” and you’ll find 49 better scripts in the first 50 results.

  19. Gravatar
    Kyle

    June 21st | #

    Than you Dan. Luckily for you, you missed the entire point of this post (as well as several other amazingly pessimistic people). The point was to learn that you can many times solve your software problems with minimal scripting.

    Cmon’ people, let’s try and use our brains a little bit now and then.

    Oh, and thanks for that SQL injection comment, I’m still rollong over that one. :)

  20. Gravatar
    Anonymous

    June 21st | #

    This is great, but how would you find out if the mail bounced or not?….and also, how would you send a back up text email along with the html email?

  21. Gravatar
    Anish

    June 21st | #

    a good tutorial for rookie but is a vulnerable to spammers. This is just old days codes, nothing new included in it.

  22. Gravatar
    Bob Newhardt

    June 22nd | #

    “The point was to learn that you can many times solve your software problems with minimal scripting.”
    That to is uninsightful. Your mistake is assuming that you know more than your audience.

    It appears to be you who are missing the point. This has been done over and over again. Calling people stupid for acknowledging that fact is an exercise in absurdity.

  23. Gravatar
    Kyle

    June 22nd | #

    Bob: Well then you better ask for your money back.

    Oh wait. My site is free.

    Like it or don’t like it people. Go enjoy the sun… maybe even go to the beach. Most importantly, remove that large stick-looking object sticking out of your shorts.

    Comments closed due to the general intelligence of man.