473,714 Members | 2,500 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

send e-mail using smtp is too slow

I have a web page that at the click of a button must send a bunch (1000+)
emails. Each email is sent individually. I have the code working fine,
using Mail Message classes and smtp and all that. But sometimes even when
I'm just sending one e-mail the web page takes a minutes or so to post. Can
anyone tell me why it is so slow, or how to fix the problem?

To address this I am thinking of just creating a queue table to write the
emails to, then using a .net console app running via sql agent scheduled job
to periodically send the emails in batch mode. However, I worry that this
may also be slow?

Does anyone have a better architecture for this solution? If so give me
some ideas. Thanks!
Dec 28 '06 #1
4 7680
This may have more to do with your e-mail server, or the security model used
by your server, than with the .Net framework. The SMTP protocol is fairly
simple and assuming you aren't sending anything that requires translation on
the sending side (from HTML to text, for example), then the sending process
itself is pretty quick.

If it is a security model issue, then you should be paying that price only
once for each attempt to send. For example, if it takes 20 seconds to log
in, and 1 second to send an e-mail, then your code should take 21 seconds to
send one email, and 30 seconds to send 10 emails. Make sure that this is
the case by testing your sending mechanism.

Regardless, you shouldn't be holding up the web page to send 1000 emails.
Note that there is an open source SMTP server on CodeProject (I don't know
much about it, though). I'm sure that it is not the only one. Perhaps that
may be a better option than writing an expensive component.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"tparks69" <tp******@discu ssions.microsof t.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
>I have a web page that at the click of a button must send a bunch (1000+)
emails. Each email is sent individually. I have the code working fine,
using Mail Message classes and smtp and all that. But sometimes even when
I'm just sending one e-mail the web page takes a minutes or so to post.
Can
anyone tell me why it is so slow, or how to fix the problem?

To address this I am thinking of just creating a queue table to write the
emails to, then using a .net console app running via sql agent scheduled
job
to periodically send the emails in batch mode. However, I worry that this
may also be slow?

Does anyone have a better architecture for this solution? If so give me
some ideas. Thanks!

Dec 28 '06 #2
"tparks69" <tp******@discu ssions.microsof t.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
Can anyone tell me why it is so slow, or how to fix the problem?
May be irrelevant, but have you seen this:
http://msdn2.microsoft.com/en-us/library/x5x13z6h.aspx
?

It's new in v2.
Dec 28 '06 #3
one further note: if you are sending a large amount of e-mails, you may want
to consider using the pickup directory. The SMTP service is already running
async. This allows the system to write your outbound mail as a file to a
directory where the service will pick it up. It's a lot more scalable for
web apps. See:
http://msdn2.microsoft.com/en-us/lib...erymethod.aspx
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.comw rote in message
news:5P******** *************** *******@comcast .com...
This may have more to do with your e-mail server, or the security model
used by your server, than with the .Net framework. The SMTP protocol is
fairly simple and assuming you aren't sending anything that requires
translation on the sending side (from HTML to text, for example), then the
sending process itself is pretty quick.

If it is a security model issue, then you should be paying that price only
once for each attempt to send. For example, if it takes 20 seconds to log
in, and 1 second to send an e-mail, then your code should take 21 seconds
to send one email, and 30 seconds to send 10 emails. Make sure that this
is the case by testing your sending mechanism.

Regardless, you shouldn't be holding up the web page to send 1000 emails.
Note that there is an open source SMTP server on CodeProject (I don't know
much about it, though). I'm sure that it is not the only one. Perhaps
that may be a better option than writing an expensive component.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"tparks69" <tp******@discu ssions.microsof t.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
>>I have a web page that at the click of a button must send a bunch (1000+)
emails. Each email is sent individually. I have the code working fine,
using Mail Message classes and smtp and all that. But sometimes even
when
I'm just sending one e-mail the web page takes a minutes or so to post.
Can
anyone tell me why it is so slow, or how to fix the problem?

To address this I am thinking of just creating a queue table to write the
emails to, then using a .net console app running via sql agent scheduled
job
to periodically send the emails in batch mode. However, I worry that
this
may also be slow?

Does anyone have a better architecture for this solution? If so give me
some ideas. Thanks!


Dec 28 '06 #4
nil

Nick Malik [Microsoft] wrote:
one further note: if you are sending a large amount of e-mails, you may want
to consider using the pickup directory. The SMTP service is already running
async. This allows the system to write your outbound mail as a file to a
directory where the service will pick it up. It's a lot more scalable for
web apps. See:
http://msdn2.microsoft.com/en-us/lib...erymethod.aspx
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.comw rote in message
news:5P******** *************** *******@comcast .com...
This may have more to do with your e-mail server, or the security model
used by your server, than with the .Net framework. The SMTP protocol is
fairly simple and assuming you aren't sending anything that requires
translation on the sending side (from HTML to text, for example), then the
sending process itself is pretty quick.

If it is a security model issue, then you should be paying that price only
once for each attempt to send. For example, if it takes 20 seconds to log
in, and 1 second to send an e-mail, then your code should take 21 seconds
to send one email, and 30 seconds to send 10 emails. Make sure that this
is the case by testing your sending mechanism.

Regardless, you shouldn't be holding up the web page to send 1000 emails.
Note that there is an open source SMTP server on CodeProject (I don't know
much about it, though). I'm sure that it is not the only one. Perhaps
that may be a better option than writing an expensive component.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"tparks69" <tp******@discu ssions.microsof t.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
>I have a web page that at the click of a button must send a bunch (1000+)
emails. Each email is sent individually. I have the code working fine,
using Mail Message classes and smtp and all that. But sometimes even
when
I'm just sending one e-mail the web page takes a minutes or so to post.
Can
anyone tell me why it is so slow, or how to fix the problem?

To address this I am thinking of just creating a queue table to write the
emails to, then using a .net console app running via sql agent scheduled
job
to periodically send the emails in batch mode. However, I worry that
this
may also be slow?

Does anyone have a better architecture for this solution? If so give me
some ideas. Thanks!
Hi
my self nilesh...and i did coding for sending one mail...but i don't
know how to send single mail to more than one mail id...and this is
required in my application..ac tually i am developing web application
for one designing institute and there should be facility of sending
mail to vendor from whom institute will purchase books and if any new
book comes in the library then every member of the library will be send
one mail...so for that i neee some help...as members of the institute
are not fix so at run time when i send mail then it should be reach to
everyone...
and as i thought for that i should take the mail id from the member
table and then fetch it in to array and then use that array to send
mail id in the for loop....

plz let me know whatever the case and it's better and i'll be thankful
to you if you can provide me code snippet of how to send one mail to
more than one id at a time or provide me any link that contains
articles on this.....

Thanks & Regards,
nil

Jan 2 '07 #5

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

Similar topics

2
19747
by: Tom Brown | last post by:
Hi, I have what seems to be a simple problem. But I can not for the life of me find a way to send an integer over a socket. The send method will only accept strings. Here is what I am trying to do: testmessage = 'test message' msglen = len(testmessage) sock.send(msglen) sock.send(testmessage)
0
1684
by: Piotr Bieniek | last post by:
Hello, I have a problem with UDP sockets. It concerns UdpClient class as well. It throws strange exceptions on subsequent Send calls. Exception is SocketException with native error code 10049. I noticed that it happens when I call Send for the second time in my program. It seemed strange, so I compiled and run Chat sample program from MSDN. To my surprise, it worked. But then I modified it. The only change was that I duplicated sending...
9
3153
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the other page, or is there something else like a stream which will be like a file. I am attempting to get a way from writing out a file and then having to give the page that I am posting to the file name. Instead I would like to just from asp.net...
0
1271
by: Markus Poehler | last post by:
Hi there! I have created NT Service that runs on a Server. It should NET SEND to a specifiv Client in a special case of environment. It does NOT net send. The Messenger Service is running. Manually executed in DOS net send works from server. I have created a 2nd NT SRV to test it that does nothing else then sending net send onStart and installed it on the server. That net send
1
15657
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if someone is interested, let me know and I will send you the codes). Once we know if the stat of Num Lock/ Caps Lock is not what we desired, we just send the Num Lock / Caps Lock key to change the stat. From most of
2
4187
by: eSolTec, Inc. 501(c)(3) | last post by:
I'm looking for code samples to send a jpg image from a client machine to a host machine. Both have the same image picWindows picture container. I would like to be able to send the image on one machine to another machine as close to realtime as possible. Also, can someone point me a direction to find out how to transmit various field of information, i.e. listboxview, listbox, textbox, datagridview etc via .NET remoting. Everything I've...
11
2665
by: Phil Hunt | last post by:
I am porting an VB6 program to .NET C# There is a NET SEND command in the VB6 program. Just wondering if there is any thing similar in the framework. Thanks.
4
10425
by: gvijayaratnam | last post by:
Hi All, I have a fn prototype as follows void print ( char *Buffer, usigned long bufferSize, int chunkSize ); This fn will accept binary file buffer and the buffer size and the chunk size, implementation must be open socket and send the buffer in chunks which is provided by the parameter.
2
1546
by: SvenV | last post by:
I based my program on the asynchronous client/server example on msdn. There weren't too many modifications to the original code. I just created some extra code to response to different messages. F.e. when I send GETARTICLES<EOF> it gets the articles from the DB and when I send something else it does that specific task. That all works fine. The problem is when I connect to the server and I try to send 2 commands after another. F.e. First get the...
7
2881
by: Thomas Mlynarczyk | last post by:
Hello, I was playing around a bit with generators using next() and send(). And I was wondering why an extra send() method was introduced instead of simply allowing an argument for next(). Also, I find it a bit counter-intuitive that send(42) not only "sets" the generator to the specified value, but yields the next value at the same time.
0
8707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9015
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7953
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.