Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Lowercase headers generated by SmtpClient

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Kraley - 22 Apr 2007 22:32 GMT
In Emails generated via SmtpClient, the names of the headers, e.g. to, from,
subject, all seem to be in lower case. Although the RFC says that header
names are case-insensitive, there are some spam filters that block mail with
lower case headers. Also google desktop appears to ignore headers that are
all lower case.

The vast majority of mail I have seen names their headers with an initial
upper case, e.g. To, From, Subject. Looking with Reflector, it seems that
these names are buried rather deep in private or internal methods.

Does anyone know a workaround?

Signature

...Mike

Walter Wang [MSFT] - 23 Apr 2007 09:10 GMT
Hi Mike,

Yes I can see there's an internal class Message has a method called
PrepareHeaders that is using lower case header names. I've also done some
further research and cannot see a supported way to override this headers
collection.

As you've already known, the header name should be case insensitive per the
RFC described; therefore the framework isn't doing anything wrong here.

If you still think it's a feature that we should add in future version of
.NET framework, please feel free to submit your feedback at
http://connect.microsoft.com/Main/content/content.aspx?ContentID=2220 which
is monitored by our product team directly. Thank you for your understanding.

In the meanwhile, you can also contact those third party vendors' support
to see if there's a way to configure those tools to ignore header name
case.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Mike Kraley - 23 Apr 2007 11:34 GMT
Thanks for your prompt reply. You've confirmed my suspicions, but of course
that isn't the answer I wanted to hear.

I did go to the product feedback site you mentioned. The issue had already
been posted, and had received a few votes. One contributor mentioned that
this was a breaking bug in Eudora. Nonetheless, MS is standing behind the
RFCs and Closed the issue. sigh.

Contact the third parties, as you mentioned, seems pretty futile. We're not
talking about isolated, specialized interests, but major applications, e.g.
Eudora, Google Desktop, etc.

I think I will just reimplement Message/MailMessage, which seems like a big
pain, but I don't see any other way around the issue.

...Mike
Signature

...Mike

> Hi Mike,
>
[quoted text clipped - 25 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Dave - 30 Apr 2007 22:42 GMT
This worked for me...
If you have it, try your version of system.web.mail instead of system.net.mail - you'll get messages telling you it's obsolete - but it'll give you the headers you want.
You need to reference system.web.mail
then:

System.Web.Mail.SmtpMail.SmtpServer = "mailrelay.trb"

Dim myMailMsg As New System.Web.Mail.MailMessage

Try

    myMailMsg.From = "to@somewhere.com"
    myMailMsg.To = "from@somewhereelse.com"
    myMailMsg.Subject = "test from dave"
    myMailMsg.Body = "This is A Test Using the web.mail namespace"
    myMailMsg.BodyFormat = Web.Mail.MailFormat.Text

    System.Web.Mail.SmtpMail.Send(myMailMsg)

Catch ex As Exception
    MsgBox("Mail err " + ex.Message)
End Try

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.