views:

1086

answers:

10

I've been given the task of optimizing HTML emails for different email/webmail clients. I used to test the HTML file by doing a trick in Outlook Express, to make it send the raw HTML, but Microsoft seems to have stopped supplying Outlook Express now (I think "Live Mail" is supposed to replace it).

So my question is, is there a simple, quick way to send HTML emails? Maybe even a freeware program that does the job?

A: 

Maybe you can use System.Net.Mail in .NET?

You can read from an email template and assing to a MailMessage body.

To send email

            System.Net.Mail.MailMessage msg = CreateMailMessage();

            SmtpClient sc = new SmtpClient();
            sc.Host = ConfigurationManager.AppSettings["SMTPServer"];
            sc.Port = 0x19;
            sc.UseDefaultCredentials = true;

            sc.Send(msg);
Ken Yao
+2  A: 

I would use python, here at the bottom is an example how to create a HTML email with a text default: http://docs.python.org/library/email-examples.html you can parameterize this, encapsulate in functions, read content from files, etc. (make sure, that you set localhost in "s = smtplib.SMTP('localhost') " to your smtp server)

Harald Schilly
A: 

I send HTML email (often in bulk) using PHPMailer. It has worked great for me.

Kristian J.
+1  A: 

I'ld go with .NET and use the SMTP server that comes with IIS (of course, this only makes sense if you are running windows)

MailMessage mail = new MailMessage();
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.Subject = "this is a test email.";
mail.BodyFormat = MailFormat.Html;
mail.Body = "this is my test email body.<br><b>this part is in bold</b>"; 
// mail.Body = READ_FROM_FILE; etc

SmtpMail.SmtpServer = "localhost";  //your real server goes here
SmtpMail.Send( mail );
DrG
There isn't actually an SMTP server built into .Net. Just classes for interacting with an existing SMTP server.
Sean Carpenter
+3  A: 

If you are just looking to test whether an HTML email displays properly in various clients, I would use sendmail.exe (windows only).

You can save a .html file and pipe it into that program on the command-line as the email content. There are command line options for from/to/subject/server, etc.

This would allow you to rapidly send and re-send emails by just editing the .html file and running the command-line again. No programming required.

Edit: there is a similar command-line tool for Linux with the same name.

Chase Seibert
A: 

Also you can use PowerShell

abatishchev
A: 

A Windows-only free solution where you typically don't have to install anything special is to use ASP or WSH. I opt for JScript instead of VBScript:

function sendHtml(recipients, subject, html) {
    var mail = Server.CreateObject("CDO.Message");

    mail.From = "Tester <[email protected]>";
    mail.Subject = subject;
    mail.To = recipients.join(";");
    mail.HTMLBody = html;

    // Do the following if you want to directly use a specific SMTP server
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/smtpserver")
        = "smtp.example.com";
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/smtpserverport")
        = 25;
    mail.Configuration.Fields.Update();

    mail.Send();
}

Note: However, your HTML may end up getting slightly reformatted with this approach.

Ates Goral
A: 

I believe you can send html emails from Mozilla's Thunderbird email client.

http://www.mozillamessaging.com/en-US/thunderbird/

This is what I used to send test emails. Or I guess you could use your email provider too.

John M
+1  A: 

I would not even go with any language ...

I would stop at MailChimp and set up a free account (max of 500 subscribers and 3000 sends per month) ... 3000 sends is enough to test right? :)

It has all the tools you need to send emails professionally (and maybe set up an account to your client/friend so they/he can use MailChimp in their Newsletters)

while you're at it, see their resources page as well the perfect tool to know what can we use in Newsletters using CampaignMonitor own Guide to CSS support in email clients

hope it helps

balexandre
*caugh* You wouldn't happen to work at MailChimp by any chance..?
Orolin
nahh, just a happy user :) and I use Campaign Monitor as well :D
balexandre
It takes a few minutes of set up, but this was a very easy and reliable way to send HTML emails. Just make a custom template, and you can write and test your own HTML emails.
mlissner
A: 

If you're on a Mac you can send HTML email super quickly using Safari and Mail. I blogged about the details at the link below, but basically you just view your HTML file in Safari and select File > Mail Contents of This Page.

http://www.ravelrumba.com/blog/send-html-email-with-safari-mail-for-fast-testing/

Rob Flaherty