473,379 Members | 1,270 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,379 software developers and data experts.

Mail.SmtpClient sending duplicates

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.DefaultNetworkCredentia ls
lsEmailSubj = "test1"
lsEmailBody = "test2"
Dim msgmail As New
System.Net.Mail.MailMessage("gl***************@myd omain.com",
"us***@mydomani.com", 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

Jun 13 '06 #1
4 3521
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" <Br***********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
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.DefaultNetworkCredentia ls
lsEmailSubj = "test1"
lsEmailBody = "test2"
Dim msgmail As New
System.Net.Mail.MailMessage("gl***************@myd omain.com",
"us***@mydomani.com", 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

Jun 13 '06 #2

"Brian Lorraine" <Br***********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
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.DefaultNetworkCredentia ls
lsEmailSubj = "test1"
lsEmailBody = "test2"
Dim msgmail As New
System.Net.Mail.MailMessage("gl***************@myd omain.com",
"us***@mydomani.com", 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.?
Jun 13 '06 #3
The code running twice wouldn't explain the email being sent both to the
TO and FROM addresses.

vMike wrote:
"Brian Lorraine" <Br***********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
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.DefaultNetworkCredentia ls
lsEmailSubj = "test1"
lsEmailBody = "test2"
Dim msgmail As New
System.Net.Mail.MailMessage("gl***************@myd omain.com",
"us***@mydomani.com", 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.?

Jun 14 '06 #4

"Ray Booysen" <rj***********@rjb.za.net> wrote in message
news:OW**************@TK2MSFTNGP02.phx.gbl...
The code running twice wouldn't explain the email being sent both to the
TO and FROM addresses.

vMike wrote:
"Brian Lorraine" <Br***********@discussions.microsoft.com> wrote in
message news:B6**********************************@microsof t.com...
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.DefaultNetworkCredentia ls
lsEmailSubj = "test1"
lsEmailBody = "test2"
Dim msgmail As New
System.Net.Mail.MailMessage("gl***************@myd omain.com",
"us***@mydomani.com", 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.
Jun 14 '06 #5

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

Similar topics

3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
3
by: dnuos | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Here's some details: ...
2
by: mazdotnet | last post by:
Hi everyone, I'm coverting some of our code here from the old way of sending mail in ..NET 1.1 to the new .NET 2.0. However, everytime I switch the code to the new method there is a delay of 1-2...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
2
by: Danny | last post by:
Hi all, Trying to send mail with System.Net.SmtpClient, using very simple code just for testing: SmtpClient smtp = new SmtpClient("mail.server.com", 25); smtp.Credentials = new...
1
by: WIzmanG | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the...
1
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.