“Mailbox unavailable” from Mailmessage

I have just spent a quite some time trying to figure out why a .Net program I wrote to e-mail users some batch-generated reports would work on my box and not on the users’ machines. Lots of googling turned up exactly nothing, although others must have experienced the same thing.

The basic program has worked fine for a long time mailing a single PDF report, but now I wanted to add some additional HTML files as attachments. This resulted in the following message on the user PC’s:

Mailbox unavailable. The server response was: 5.6.0 Invalid header found (see RFC2822 section 3.6)

What I discovered is that the System.Net.Mail.MailMessage component happily submits .pdf files, .zip files, .txt files and probably a host of others – it’s apparently just .htm and .html files it that makes it (or the mail server?) unhappy!

So what was different? Well, it was the framework. As soon as a user PC hitherto running .Net 4.0 got the latest and greatest .Net Framework 4.5 installed everything was honky-dory and mails flew out over the wire.

Was this a feature or a flaw? Or was it the combination with a fairly restrictive mail-server? Hard to say – but at least my code is now working and I can get on with my life… Smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s