Bug in "MailMessage" ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?YmVuamk=?=

    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.Heade rs.Add(addresso ne + "," + 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 "MailAddres s" 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:



    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
  • rowe_newsgroups

    #2
    Re: Bug in "MailMessa ge" ?

    On Aug 14, 8:22 pm, benji <be...@discussi ons.microsoft.c omwrote:
    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.Heade rs.Add(addresso ne + "," + 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 "MailAddres s" 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:
    >

    >
    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
    On July 1, Canada celebrates its national day, mar


    Thanks,

    Seth Rowe [MVP]

    Comment

    • =?Utf-8?B?YmVuamk=?=

      #3
      Re: Bug in &quot;MailMessa ge&quot; ?

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

      "rowe_newsgroup s" wrote:
      On Aug 14, 8:22 pm, benji <be...@discussi ons.microsoft.c omwrote:
      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.Heade rs.Add(addresso ne + "," + 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 "MailAddres s" 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:



      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
      On July 1, Canada celebrates its national day, mar

      >
      Thanks,
      >
      Seth Rowe [MVP]

      >

      Comment

      • rowe_newsgroups

        #4
        Re: Bug in &quot;MailMessa ge&quot; ?

        On Aug 14, 10:54 pm, benji <be...@discussi ons.microsoft.c omwrote:
        Can you confirm for me if this looks like a bug, or a mistake in my technique
        for setting the reply-to header?
        >
        "rowe_newsgroup s" wrote:
        On Aug 14, 8:22 pm, benji <be...@discussi ons.microsoft.c omwrote:
        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.Heade rs.Add(addresso ne + "," + 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 "MailAddres s" 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:
        >>
        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,
        >
        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]

        Comment

        • Gilianthuro

          #5
          Re: Bug in &quot;MailMessa ge&quot; ?


          "benji" <benji@discussi ons.microsoft.c omwrote
          mymessage.Heade rs.Add(addresso ne + "," + addresstwo)
          Did you try + ";" instead of + "," ?

          Steven

          Comment

          • =?Utf-8?B?YmVuamk=?=

            #6
            Re: Bug in &quot;MailMessa ge&quot; ?

            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

            "Gilianthur o" wrote:
            >
            "benji" <benji@discussi ons.microsoft.c omwrote
            >
            mymessage.Heade rs.Add(addresso ne + "," + addresstwo)
            >
            Did you try + ";" instead of + "," ?
            >
            Steven

            Comment

            Working...