Bug in "MailMessage" ?

B

benji

Hi,

Working with VB.NET 2005. I've got a mailmessage object and I set it up so
that when the recipient replies, the reply address is a string of two
different email addresses together. I used a line like the following:

mymessage.Headers.Add(addressone + "," + addresstwo)

Everything worked as expected when running on framework 2.0. However, after
installing 2.0 SP1, the behavior broke. This header was stripped out of the
message. I ran under the debugger and confirmed that before the message was
passed to the smtp object for sending, there was the single header. After,
that header was gone, replaced by other headers as expected for properties
such as frmo and to which were set. What's going on? This happens in
framework 3.5 as well.

I would set the "ReplyTo" property of the message but you have to set it to
a "MailAddress" and it will only accept a single address. Trying to set it to
more than one, it simply trims after the first address in the string with no
warning (I believe I used to get an exception before SP1).

I see a few changes in the mail namespace with 2.0 SP1:

http://support.microsoft.com/kb/945757

So 2 questions:

1) is this a defect?
2) Can anyone share example code that would allow me to set a header such
that the "reply-to" would be a stringn of 2 email addresses, and would work
correctly running on 2.0 SP1 or 3.5?
3) Is anyone able to successfully add ANY custom headers to a mail message
after 2.0?

Thank you...

-Ben
 
R

rowe_newsgroups

Hi,

Working with VB.NET 2005. I've got a mailmessage object and I set it up so
that when the recipient replies, the reply address is a string of two
different email addresses together. I used a line like the following:

mymessage.Headers.Add(addressone + "," + addresstwo)

Everything worked as expected when running on framework 2.0. However, after
installing 2.0 SP1, the behavior broke. This header was stripped out of the
message. I ran under the debugger and confirmed that before the message was
passed to the smtp object for sending, there was the single header. After,
that header was gone, replaced by other headers as expected for properties
such as frmo and to which were set. What's going on? This happens in
framework 3.5 as well.

I would set the "ReplyTo" property of the message but you have to set it to
a "MailAddress" and it will only accept a single address. Trying to set it to
more than one, it simply trims after the first address in the string withno
warning (I believe I used to get an exception before SP1).

I see a few changes in the mail namespace with 2.0 SP1:

http://support.microsoft.com/kb/945757

So 2 questions:

1) is this a defect?
2) Can anyone share example code that would allow me to set a header such
that the "reply-to" would be a stringn of 2 email addresses, and would work
correctly running on 2.0 SP1 or 3.5?
3) Is anyone able to successfully add ANY custom headers to a mail message
after 2.0?

Thank you...

-Ben

If you believe this to be a bug, you need to report it at
http://connect.microsoft.com/

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
B

benji

Can you confirm for me if this looks like a bug, or a mistake in my technique
for setting the reply-to header?
 
R

rowe_newsgroups

Can you confirm for me if this looks like a bug, or a mistake in my technique
for setting the reply-to header?

Nope, I can't because I'm not sure. I'd hate to even comment and have
my guess seem like an official answer (I'm not from Microsoft).
However when you report a bug to connect, a person from Microsoft
(usually from the .NET development team) will respond saying whether
it is a bug or it is by design.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
B

benji

The ";" resulted in an exception being thrown when constructing the mail
address (as opposed to just ignoring what was after the comma).

I found a way around this but it's not too pretty: Construct a mailaddress
with whatever value, and use reflection (type data) to drectly change the
address field (bypassing the Address property which does checking).

-Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top