Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

SMTP clients?

Any good SMTP clients with reasonable licenses?
In particular, ones which can send HTML messages with embedded images.

system.web.mail almost works, but not quite. i suppose we could de-compile and re-compile it with 10 new lines of code to call CDO correctly.

indy almost works, but not quite. has an unusable license and doesn't claim to support this. easymail (the commercial version) license might not be such a bad idea at $200, but that's for one developer, which might not work as responsibilities shift over time. plus it's overkill.

writing our own is pretty easy, actually, but why is this not already out there?

Tuesday, November 30, 2004

There are plenty of examples of code to build SMTP clients using sockets instead of System.Web.Mail/CDO for example:

This might be an option if you can't find a pre-built solution.

I'd be interested to know in what way System.Web.Mail is at fault when embedding images in HTML. Is it that it doesn't work at all or is it some quirky behaviour?

Wednesday, December 1, 2004

It's been a while since I looked at it, but if I remember right it has one fundamentally missing piece:

You can't set any properties on the message or the attachment.

There are two basic ways to embed images: using content-id and cid, and using some technique which basically says "look for url 'abc' in the parts of the message before going online". Both require just a few properties be set on attachments and/or the message itself, and while CDO supports it, the framework mail wrappers don't.

I had decompiled it to the point of finding that it really would take something like 5 lines of code to make this work.

Wednesday, December 1, 2004

We use OpenSmtp, an open-source email client for .NET, for our mailing stuff:

I didn't look to see if it allows the properties you need set, but can say that it works well for us.


Cory Foy (
Wednesday, December 1, 2004

It is possible to set some properties on the MailMessage class using the poorly documented Fields property, if you are using version 1.1 of the .NET Framework:

There's an example of this technique here that makes up for the poor MSDN documentation:

I can't see any field properties that match up with your described techniques for inline images though. I suspect you need to set the content-id on an attachment part and the Fields property doesn't seem to be available for the MailAttachment class.

If you find a way of replacing or extending System.Web.Mail to achieve inline images then I'd be interested to know as I suspect we'll need to do something similar in the near future.

Wednesday, December 1, 2004

There's a recent feature request for inline images in html e-mails for on SourceForge:

So it seems unlikely that it supports it yet.

Wednesday, December 1, 2004

Thank you to the reference to OpenSMTP--it works perfectly.

I don't know what the feature request mentioned above is for. Apparently the documentation is poor, but sending an embedded image is one of the test cases which comes as part of the package.

Thursday, December 2, 2004

*  Recent Topics

*  Fog Creek Home