473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Bug in "MailMessage" ?

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
Aug 15 '08 #1
5 1235
On Aug 14, 8:22*pm, benji <be...@discussions.microsoft.comwrote:
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/
Aug 15 '08 #2
Can you confirm for me if this looks like a bug, or a mistake in my technique
for setting the reply-to header?

"rowe_newsgroups" wrote:
On Aug 14, 8:22 pm, benji <be...@discussions.microsoft.comwrote:
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

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/
Aug 15 '08 #3
On Aug 14, 10:54*pm, benji <be...@discussions.microsoft.comwrote:
Can you confirm for me if this looks like a bug, or a mistake in my technique
for setting the reply-to header?

"rowe_newsgroups" wrote:
On Aug 14, 8:22 pm, benji <be...@discussions.microsoft.comwrote:
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 setit 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
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/
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/
Aug 15 '08 #4

"benji" <be***@discussions.microsoft.comwrote
mymessage.Headers.Add(addressone + "," + addresstwo)
Did you try + ";" instead of + "," ?

Steven
Aug 15 '08 #5
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

"Gilianthuro" wrote:
>
"benji" <be***@discussions.microsoft.comwrote
mymessage.Headers.Add(addressone + "," + addresstwo)

Did you try + ";" instead of + "," ?

Steven
Aug 16 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from this website. I have it working just fine. I'm...
3
by: dp | last post by:
I am using the following code in .net 2: MailAddress fromAddress = new MailAddress("valid_smtp_addr", "name"); MailMessage message = new MailMessage(); message.From = fromAddress;...
0
by: desi.american | last post by:
I'm using System.Web.Mail to send an email message from an ASP.NET web page. This is the main section of the code. //************* start code ***************************** string mailHost =...
4
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. --->...
5
by: lds | last post by:
I am getting the following error: The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
3
by: Frank | last post by:
I am attempting to develop a solution where I handle bounced e-mails. I wish to field all bounced emails in a custom email account such a bounced@mycompany.com From the aricle at...
1
by: samarthkumar84 | last post by:
Hi I had used following code for sending e-mail but facing this problem. I want to send this e-mail in ASP.NET using VB.NET code. I am attaching both code an output. CODE Imports...
1
by: =?Utf-8?B?VGFsYWxTYWxlZW0=?= | last post by:
i have facility in my website which sends an e-mail to the cleint's inbox..... i am getting a problem when ever i sends an e-mail.. i tried with Hotmail and Yahoo, e-mail goes to the "Junk Mail"...
0
by: Afshar | last post by:
Whenever I add a key to Headers it turns to a lower cased one while Headers is of type NameValueCollection and NameValueCollection itslef does not apply any lower or upper case change. Please...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.