Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Have a .NET program that uses the System.Net.Main namespace to send an email via SMTP.

Its on a customers site so from there it will go via a (series of?) SMTP relay servers before it reaches its destination.

At the moment I have no information about this smtp replay / email infrastructure (and getting that information is going to be hard).

Somewhere along the line an exclamation mark is being inserted into long URL's in the the email around 100 chars in from the start of a line.

EDIT- Actually have found its about 1000 chars in

This is not happening on a test system or hundreds of other sites.

I feel sure this has to be something to do with escape codes to break long lines up.

Anyone got any ideas?

share|improve this question
    
Found out its not 100 chars into a link, its approx 1000 chars into the message. This gives more info but still mystery why only ever reported by one customer. Perhaps some smtp servers are more tolerant than others? systemwebmail.com/faq/4.4.5.aspx –  Ryan Sep 4 '09 at 20:12

3 Answers 3

up vote 7 down vote accepted

Got hit with this myself.

If you are building a html message without any carriage returns in it, you may get errors somewhere around the 1000 character mark.

Solution is to add a few \r\n characters so that each line is smaller than 1000 (or 988 if you don't count the \r\n characters).

See section 2.1.1. Line Length Limits of RFC 2822 for more details.

share|improve this answer
    
Thanks - also see discussions on this post - systemwebmail.com/faq/4.4.5.aspx –  Ryan Sep 4 '09 at 21:27

Wrapping at a certain number of characters is usually a client issue. If you're not seeing it at your other sites, or on a test machine I don't think its your code. See if you can't find out what client is being used to receive the message-it could be some crufty old thing thats auto wrapping at a certain number of characters.

share|improve this answer

It does not sound like the .Net app is causing the issue if the problem is not happening on many other sites where the same code is running. Is the problem site behind some kind of application firewall or anti-spam device that might be monitoring the smtp stream? If so, there might be a rule about truncating long URLs that is being triggered which then causes the URLs in the email to be shortened.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.