Mail.SmtpClient sending duplicates

Discussion in 'ASP .Net' started by =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=, Jun 13, 2006.

  1. I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0 and I
    love it, but there's just one problem. When it sends an email out, it sends
    to BOTH the TO and the FROM address. I have the following code which is very
    simple.

    ------------------------snip----------------------------------
    Dim client = New System.Net.Mail.SmtpClient("mail.mydomain.net")
    client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
    lsEmailSubj = "test1"
    lsEmailBody = "test2"
    Dim msgmail As New
    System.Net.Mail.MailMessage("",
    "", lsEmailSubj, lsEmailBody)
    client.Send(msgmail)
    --------------------------------------------------------------

    This is the only part of my code that actually sends out the email and the
    TO and FROM are hardcoded as you can see. However, TWO emails get sent out.
    One is from globalitreporting, to user1 .. and... then it sends out the
    second email FROM globalitreporting TO globalitreporting.

    The really strange thing is that this only happens SOMETIMES, maybe 1/3 of
    the time. Is there something about the SmtpClient class that I am forgetting
    or is there some setting on my SMTP server that might be messing this up?

    Does anyone have any ideas? ;)

    ->Brian Lorraine
    =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=, Jun 13, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=

    sloan Guest

    I have some email send code at my blog
    spaces.msn.com/sholliday/
    and i have never gotten a duplicate.


    there is 1.1 and 2.0 code there.

    I am not using an overloaded constructor like you are , fyi.



    "Brian Lorraine" <> wrote in message
    news:...
    > I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0 and

    I
    > love it, but there's just one problem. When it sends an email out, it

    sends
    > to BOTH the TO and the FROM address. I have the following code which is

    very
    > simple.
    >
    > ------------------------snip----------------------------------
    > Dim client = New System.Net.Mail.SmtpClient("mail.mydomain.net")
    > client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
    > lsEmailSubj = "test1"
    > lsEmailBody = "test2"
    > Dim msgmail As New
    > System.Net.Mail.MailMessage("",
    > "", lsEmailSubj, lsEmailBody)
    > client.Send(msgmail)
    > --------------------------------------------------------------
    >
    > This is the only part of my code that actually sends out the email and the
    > TO and FROM are hardcoded as you can see. However, TWO emails get sent

    out.
    > One is from globalitreporting, to user1 .. and... then it sends out the
    > second email FROM globalitreporting TO globalitreporting.
    >
    > The really strange thing is that this only happens SOMETIMES, maybe 1/3 of
    > the time. Is there something about the SmtpClient class that I am

    forgetting
    > or is there some setting on my SMTP server that might be messing this up?
    >
    > Does anyone have any ideas? ;)
    >
    > ->Brian Lorraine
    >
    sloan, Jun 13, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=

    vMike Guest

    "Brian Lorraine" <> wrote in message
    news:...
    >I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0 and I
    > love it, but there's just one problem. When it sends an email out, it
    > sends
    > to BOTH the TO and the FROM address. I have the following code which is
    > very
    > simple.
    >
    > ------------------------snip----------------------------------
    > Dim client = New System.Net.Mail.SmtpClient("mail.mydomain.net")
    > client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
    > lsEmailSubj = "test1"
    > lsEmailBody = "test2"
    > Dim msgmail As New
    > System.Net.Mail.MailMessage("",
    > "", lsEmailSubj, lsEmailBody)
    > client.Send(msgmail)
    > --------------------------------------------------------------
    >
    > This is the only part of my code that actually sends out the email and the
    > TO and FROM are hardcoded as you can see. However, TWO emails get sent
    > out.
    > One is from globalitreporting, to user1 .. and... then it sends out the
    > second email FROM globalitreporting TO globalitreporting.
    >
    > The really strange thing is that this only happens SOMETIMES, maybe 1/3 of
    > the time. Is there something about the SmtpClient class that I am
    > forgetting
    > or is there some setting on my SMTP server that might be messing this up?
    >
    > Does anyone have any ideas? ;)
    >
    > ->Brian Lorraine
    >

    Maybe something in you code is causing this process to run twice. How is it
    called.?
    vMike, Jun 13, 2006
    #3
  4. =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=

    Ray Booysen Guest

    The code running twice wouldn't explain the email being sent both to the
    TO and FROM addresses.

    vMike wrote:
    > "Brian Lorraine" <> wrote in message
    > news:...
    >> I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0 and I
    >> love it, but there's just one problem. When it sends an email out, it
    >> sends
    >> to BOTH the TO and the FROM address. I have the following code which is
    >> very
    >> simple.
    >>
    >> ------------------------snip----------------------------------
    >> Dim client = New System.Net.Mail.SmtpClient("mail.mydomain.net")
    >> client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
    >> lsEmailSubj = "test1"
    >> lsEmailBody = "test2"
    >> Dim msgmail As New
    >> System.Net.Mail.MailMessage("",
    >> "", lsEmailSubj, lsEmailBody)
    >> client.Send(msgmail)
    >> --------------------------------------------------------------
    >>
    >> This is the only part of my code that actually sends out the email and the
    >> TO and FROM are hardcoded as you can see. However, TWO emails get sent
    >> out.
    >> One is from globalitreporting, to user1 .. and... then it sends out the
    >> second email FROM globalitreporting TO globalitreporting.
    >>
    >> The really strange thing is that this only happens SOMETIMES, maybe 1/3 of
    >> the time. Is there something about the SmtpClient class that I am
    >> forgetting
    >> or is there some setting on my SMTP server that might be messing this up?
    >>
    >> Does anyone have any ideas? ;)
    >>
    >> ->Brian Lorraine
    >>

    > Maybe something in you code is causing this process to run twice. How is it
    > called.?
    >
    >
    Ray Booysen, Jun 14, 2006
    #4
  5. =?Utf-8?B?QnJpYW4gTG9ycmFpbmU=?=

    vMike Guest

    "Ray Booysen" <> wrote in message
    news:...
    > The code running twice wouldn't explain the email being sent both to the
    > TO and FROM addresses.
    >
    > vMike wrote:
    >> "Brian Lorraine" <> wrote in
    >> message news:...
    >>> I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0
    >>> and I
    >>> love it, but there's just one problem. When it sends an email out, it
    >>> sends
    >>> to BOTH the TO and the FROM address. I have the following code which is
    >>> very
    >>> simple.
    >>>
    >>> ------------------------snip----------------------------------
    >>> Dim client = New System.Net.Mail.SmtpClient("mail.mydomain.net")
    >>> client.Credentials =
    >>> System.Net.CredentialCache.DefaultNetworkCredentials
    >>> lsEmailSubj = "test1"
    >>> lsEmailBody = "test2"
    >>> Dim msgmail As New
    >>> System.Net.Mail.MailMessage("",
    >>> "", lsEmailSubj, lsEmailBody)
    >>> client.Send(msgmail)
    >>> --------------------------------------------------------------
    >>>
    >>> This is the only part of my code that actually sends out the email and
    >>> the
    >>> TO and FROM are hardcoded as you can see. However, TWO emails get sent
    >>> out.
    >>> One is from globalitreporting, to user1 .. and... then it sends out the
    >>> second email FROM globalitreporting TO globalitreporting.
    >>>
    >>> The really strange thing is that this only happens SOMETIMES, maybe 1/3
    >>> of
    >>> the time. Is there something about the SmtpClient class that I am
    >>> forgetting
    >>> or is there some setting on my SMTP server that might be messing this
    >>> up?
    >>>
    >>> Does anyone have any ideas? ;)
    >>>
    >>> ->Brian Lorraine
    >>>

    >> Maybe something in you code is causing this process to run twice. How is
    >> it called.?
    >>


    ha , of course.
    vMike, Jun 14, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SG90UVE=?=
    Replies:
    0
    Views:
    3,302
    =?Utf-8?B?SG90UVE=?=
    May 6, 2005
  2. Replies:
    3
    Views:
    1,168
  3. mazdotnet

    ASP 2.0 Net.Mail.SmtpClient Delay

    mazdotnet, May 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    6,272
    sloan
    May 9, 2006
  4. refv8
    Replies:
    2
    Views:
    27,039
    ittower
    Oct 13, 2006
  5. Replies:
    0
    Views:
    1,333
Loading...

Share This Page