Mail.SmtpClient sending duplicates

G

Guest

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("(e-mail address removed)",
"(e-mail address removed)", 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
 
S

sloan

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.
 
V

vMike

Brian Lorraine said:
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("(e-mail address removed)",
"(e-mail address removed)", 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.?
 
R

Ray Booysen

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

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top