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

slow system.net.mail mailmessage

Hi all, I am using an asp.net page to send e-mail to an internal exchange
server. The code completes, but the mail doesn't get sent from webserver for
at least a minute or more. Is there any reason why the e-mail is delayed?
My code to mail is below:

public void SendEmailToTechnician(string sTo, string sSubject, string
sBody)
{
oMailMessage.From = new
MailAddress(ConfigurationManager.AppSettings["SMTPFromAddress"].ToString());
oMailMessage.To.Add(new MailAddress(sTo));
oMailMessage.Subject = sSubject;
oMailMessage.Body = sBody + "<END MESSAGE>";
oMailMessage.IsBodyHtml = false;
oMailMessage.Priority = MailPriority.High;

SmtpClient oClient = new
SmtpClient(ConfigurationManager.AppSettings["SMTPServer"].ToString());
oClient.DeliveryMethod = SmtpDeliveryMethod.Network;
try
{
oClient.Send(oMailMessage);
}
catch (Exception ex)
{
oGlobal.Redirect("Error.aspx?Error=" + ex.Message.ToString() +
"&STACK=" + ex.StackTrace.ToString());
}
}
Feb 27 '06 #1
9 10329
Hello, JoshP!

Your code only sends email to the smtp server. This server then delivers the mail to the specified destination address.

So, I'd recommend you to check the smtp server, why does it takes it so long to deliver mail.

If you have access to the smtp server, you can check its log and verify when mails was received and sent

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 27 '06 #2
Thanks for the reply Vadym. Interestingly enough, the webserver has Symantec
Antivirus installed and when mail is sent you can see Symantec scanning the
mail. However, Symantec on the webserver doesn't even see the message being
sent for at least 45 seconds after the mail code is run. Any ideas? I have
tried disabling Symantec to see if I get any speed increases--no luck.

Thanks,
Josh

"Vadym Stetsyak" wrote:
Hello, JoshP!

Your code only sends email to the smtp server. This server then delivers the mail to the specified destination address.

So, I'd recommend you to check the smtp server, why does it takes it so long to deliver mail.

If you have access to the smtp server, you can check its log and verify when mails was received and sent

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 27 '06 #3
Hello, JoshP!

You mean that Symantec is on the sender and on the smtp server?
You can try to see what is going on in the network level, using network sniffing tools ( Network monitor or Ethereal )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 27 '06 #4
Hi Vadym, I ran a network trace using Ethereal. The SMTP converstation with
the mail server begins immediately. However, after a brief millisecond, the
converstation stops at 250 2.0.0 Resetting. It waits about 25-30 seconds
then begins transmitting the data. I.e.:

Response: 250 2. 0.0 Resetting
Mail From:<em***@doman.com>
250 2.1.0 em***@domain.com. . . Sender OK
etc... etc... etc... until email is sent.

Wonder what the delay is caused by at the "Resetting" point in the
converstation?

"Vadym Stetsyak" wrote:
Hello, JoshP!

You mean that Symantec is on the sender and on the smtp server?
You can try to see what is going on in the network level, using network sniffing tools ( Network monitor or Ethereal )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 27 '06 #5
Hello, JoshP!

J> Response: 250 2. 0.0 Resetting
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

J> Wonder what the delay is caused by at the "Resetting" point in the
J> converstation?

No, resetting has nothing to do here.
You mean that it looks like this

J> Response: 250 2. 0.0 Resetting
Here goest the delay (45 sec ) and then everything runs smoothly?
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

If the upper is true, then it is the problem on the sender side.

Did you disable virus checking completely? ( in the low level untivirus device driver may still analyze data but won't prompt about it )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 27 '06 #6
Hi,

In addition I would suggest you to send the email from a Thread , this will
allow that the user get a response page fast while the email is processed in
the server.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:uE*************@TK2MSFTNGP12.phx.gbl...
Hello, JoshP!

J> Response: 250 2. 0.0 Resetting
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

J> Wonder what the delay is caused by at the "Resetting" point in the
J> converstation?

No, resetting has nothing to do here.
You mean that it looks like this

J> Response: 250 2. 0.0 Resetting
Here goest the delay (45 sec ) and then everything runs smoothly?
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

If the upper is true, then it is the problem on the sender side.

Did you disable virus checking completely? ( in the low level untivirus
device driver may still analyze data but won't prompt about it )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

Feb 27 '06 #7
Hi Vadym, you were right!! The problem was from the sender-side. When I
disabled Symantec Corporate Antivirus, I did it from the icon in the system
tray. Once I disabled the service in the services snap-in the mail would
send right away. I still don't understand how or why Symantec Antivirus
would cause a 58 second delay in sending e-mail.

"Vadym Stetsyak" wrote:
Hello, JoshP!

J> Response: 250 2. 0.0 Resetting
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

J> Wonder what the delay is caused by at the "Resetting" point in the
J> converstation?

No, resetting has nothing to do here.
You mean that it looks like this

J> Response: 250 2. 0.0 Resetting
Here goest the delay (45 sec ) and then everything runs smoothly?
J> Mail From:<em***@doman.com>
J> 250 2.1.0 em***@domain.com. . . Sender OK
J> etc... etc... etc... until email is sent.

If the upper is true, then it is the problem on the sender side.

Did you disable virus checking completely? ( in the low level untivirus device driver may still analyze data but won't prompt about it )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 28 '06 #8
IMHO it depends on the mail being send, if it has binary attachments.
OR there is a bug in the Symantec scanner...

What are you sending in your mails?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 28 '06 #9
I am sending plain text only. Also, I am using the latest available
Syamantec Antivirus Corporate Edition. I think I will give Symantec a call
and find out how the mail scanner code works. Thanks for your time and
helping me solve or at least identify the problem. Thanks Again....

"Vadym Stetsyak" wrote:
IMHO it depends on the mail being send, if it has binary attachments.
OR there is a bug in the Symantec scanner...

What are you sending in your mails?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 28 '06 #10

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

Similar topics

4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
20
by: Adrian | last post by:
What does this error mean? Could not access CDO Message Object. Many thanks.
3
by: Phil Mc | last post by:
Hi has anyone come accross the problem.... with referance to System.Web.Mail.MailMessage and System.Web.Mail.SmtpMail THIS WORKS FINE mail=new MailMessage(); mail.From =...
5
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to...
3
by: pmud | last post by:
Hi, I have ab ASP.Net Application in which I need to send e-mail on button click. Even though my C# code for that is correct.I am getting the following error:: I think the following error can be...
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
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...
0
by: Fabuloussites | last post by:
I've made small class to sent email using the system.net.mail namespace and it is really slow. any ideas why i'm having such a performance hit? it seems to work much better when i don't use...
1
by: maflatoun | last post by:
Hi everyone, I'm coverting some of our code here from the old way of send email in ..net 1.1 to the new .net 2.0. However, everyone I switch the code the new method there is a delay of 1-2...
2
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.