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

SmtpMail.Send - First Call is very slow

5
I have created vb.net dll which sends emails using SmtpMail.Send method.
I am using the same dll in two exe projects lets call them projSlow and projfast. For projSlow - the first call to SmtpMail.Send takes about 12 seconds the next call takes less then 1 sec, in projefast I don't see any preformance issues all calls take less then 1 sec. Both projSlow and projFast are executed on same machine windows 2000.

Why is call to SmtpMail.Send slow in projSlow?
Dec 21 '07 #1
9 2443
Plater
7,872 Expert 4TB
Do you always execute projslow before projfast?
It could be that the first call does some work that gets cached locally (like a DNS name lookup or something) and any calls made after use the cached values?
Dec 21 '07 #2
An2
5
Do you always execute projslow before projfast?
It could be that the first call does some work that gets cached locally (like a DNS name lookup or something) and any calls made after use the cached values?
No - I did test for that. Even if I ececute projslow 4 or 5 times and lets say there are 2 SMTPMail.Send calls in the projslow, the first call is always slow.
I have been testing all day, can't figure out what can be wrong.

This is what shows in the log file for the two calls:
#Fields: date time cs-method time-taken
2007-12-21 18:22:40 HELO 0
2007-12-21 18:22:40 MAIL 0
2007-12-21 18:22:40 RCPT 0
2007-12-21 18:22:40 RCPT 0
2007-12-21 18:22:40 RCPT 0
2007-12-21 18:22:40 DATA 94
2007-12-21 18:22:40 QUIT 0
2007-12-21 18:22:40 HELO 0
2007-12-21 18:22:40 MAIL 0
2007-12-21 18:22:40 RCPT 0
2007-12-21 18:22:40 DATA 172
2007-12-21 18:22:40 QUIT 0


I recorded the time before and after the SMTP send call - for first call in projSlow it takes 14.0001792 and sec call in projSlow it takes 0.1875024.

The log file does not seem to show that it takes 14.0001792 sec in the first call. Not sure where time is spend when SMTP.Send is called
Dec 21 '07 #3
Plater
7,872 Expert 4TB
The first call has 3 people the email is being sent to, perhaps the mail server is taking longer to sort out if the rcpt name is valid or not?
Seems like a very long time though.
Dec 21 '07 #4
An2
5
The first call has 3 people the email is being sent to, perhaps the mail server is taking longer to sort out if the rcpt name is valid or not?
Seems like a very long time though.

If commented out the first call in projSlow and just ran the second call - that also took around 14 seconds
Dec 21 '07 #5
Plater
7,872 Expert 4TB
Very strange.
Are both projects talking to the same mail server?
Dec 21 '07 #6
An2
5
Very strange.
Are both projects talking to the same mail server?
Yes they are I am all out ideas - not sure what to try
Dec 21 '07 #7
Plater
7,872 Expert 4TB
Yes they are I am all out ideas - not sure what to try
I have never been happy with Microsoft's SMTPClient implementation in .NET, unfortunatly there was never a good alternative that I could find.

In project slow, if you made the 2nd call first and the 1st call second, what is the result?

Such as previously:
Call A (slow)
Call B (fast)

If you swap them:
Call B (slow?)
Call A (fast?)
Dec 21 '07 #8
An2
5
I have never been happy with Microsoft's SMTPClient implementation in .NET, unfortunatly there was never a good alternative that I could find.

In project slow, if you made the 2nd call first and the 1st call second, what is the result?

Such as previously:
Call A (slow)
Call B (fast)

If you swap them:
Call B (slow?)
Call A (fast?)

What I did was comment out the CALL A and just left Call B - then CAll B took about 14 seconds to run
Dec 21 '07 #9
Plater
7,872 Expert 4TB
That really sounds like there is caching involved somewhere. (Not sure why)
I guess you could try looking up chaching and the SMTPMail.Send() to see if anyone else has said anything about it?
Dec 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Edwin G. Castro | last post by:
I'm using the System.Web.Mail.SmtpMail class to send email from an app I wrote. I needed to install IIS to get it to send the messages even though I wanted to use an existing SMTP server. Anyway, I...
4
by: Xerox | last post by:
The SmtpMail class has a static property to set the server and a static method to send an email. But if its static, how can it work in a multithreaded environment? Surely one would want to create...
4
by: bonbon | last post by:
I used SmtpMail class sent email in asp.net before, no problem. Now I moved to Windows XP and Visual Studio .NET 2003. My ASP.NET app can not send out any email. The following exception is thrown:...
7
by: Jason | last post by:
Hi just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25? Thanks Jason
5
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. ...
0
by: Erwan | last post by:
I have a strange (but very blocking) result when using the smtpmail class from an ASPX page : here is the (very simple !) code... '-------------------------------------------------- mail.To =...
1
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
1
by: Phill. W | last post by:
Have Our Friends in Redmond put delay loops into the SMTPMail.Send() method, or does it /really/ take almost a second to send a mail message? I've written a windows service that send emails. ...
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: 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
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.