473,761 Members | 7,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SmtpMail - not multithread friendly?

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 an instance of
the server and invoke the send() method?
Jul 21 '05 #1
4 1611
there are some commercial components that may provide better capability for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:en******** ******@TK2MSFTN GP15.phx.gbl...
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 an instance of
the server and invoke the send() method?

Jul 21 '05 #2
My code will be running inside a server (BizTalk server). I don't have
control over the number of threads, BizTalk manages this. Therefore, would
you say that using SmtpMail is unsafe in an environment like this? Should I
wrap all use of SmtpMail within a static synchronized method?

I can envisage a scenario where one thread changes the smtp server property,
is just about to call send message, when another thread that it knows
nothing about updates the smtp server property to something else.

"Nick Malik" <ni*******@hotm ail.nospam.com> wrote in message
news:1m_td.4689 43$wV.356468@at tbi_s54...
there are some commercial components that may provide better capability for multithreaded sending.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:en******** ******@TK2MSFTN GP15.phx.gbl...
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 an instance of the server and invoke the send() method?


Jul 21 '05 #3
Actually, what I would recommend is that you purchase, for less than $300, a
license for a commercially available SMTP component that is multi-thread
ready, rather than adding a bottleneck that will undoubtably cost you
considerable performance in a biztalk environment.

Performance hits in biztalk are very difficult to diagnose, and may of my
past clients have gone so far as adding expensive hardware as a "test" to
see if Biztalk performance would improve.

Given the potential for future expense due to a design flaw in a small
corner of .net, why not spend a small amount of money, right now, for a
component that doesn't have the flaw?

Otherwise, for the hope to save $300, you could slow down a system that
costs thousands, and incur the liklihood that additional thousands will be
spent trying to shore it up.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:e6******** ******@TK2MSFTN GP12.phx.gbl...
My code will be running inside a server (BizTalk server). I don't have
control over the number of threads, BizTalk manages this. Therefore, would
you say that using SmtpMail is unsafe in an environment like this? Should I wrap all use of SmtpMail within a static synchronized method?

I can envisage a scenario where one thread changes the smtp server property, is just about to call send message, when another thread that it knows
nothing about updates the smtp server property to something else.

"Nick Malik" <ni*******@hotm ail.nospam.com> wrote in message
news:1m_td.4689 43$wV.356468@at tbi_s54...
there are some commercial components that may provide better capability

for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:en******** ******@TK2MSFTN GP15.phx.gbl...
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 an instance of the server and invoke the send() method?



Jul 21 '05 #4
Very sound advice, thanks Nick. As you state, it is a bit of a design flaw
in the framework - unusual though that they should have done it that way.

Thanks again.

"Nick Malik" <ni*******@hotm ail.nospam.com> wrote in message
news:Iajud.5476 46$D%.137565@at tbi_s51...
Actually, what I would recommend is that you purchase, for less than $300, a license for a commercially available SMTP component that is multi-thread
ready, rather than adding a bottleneck that will undoubtably cost you
considerable performance in a biztalk environment.

Performance hits in biztalk are very difficult to diagnose, and may of my
past clients have gone so far as adding expensive hardware as a "test" to
see if Biztalk performance would improve.

Given the potential for future expense due to a design flaw in a small
corner of .net, why not spend a small amount of money, right now, for a
component that doesn't have the flaw?

Otherwise, for the hope to save $300, you could slow down a system that
costs thousands, and incur the liklihood that additional thousands will be
spent trying to shore it up.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:e6******** ******@TK2MSFTN GP12.phx.gbl...
My code will be running inside a server (BizTalk server). I don't have
control over the number of threads, BizTalk manages this. Therefore, would
you say that using SmtpMail is unsafe in an environment like this? Should
I
wrap all use of SmtpMail within a static synchronized method?

I can envisage a scenario where one thread changes the smtp server

property,
is just about to call send message, when another thread that it knows
nothing about updates the smtp server property to something else.

"Nick Malik" <ni*******@hotm ail.nospam.com> wrote in message
news:1m_td.4689 43$wV.356468@at tbi_s54...
there are some commercial components that may provide better

capability for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.co m> wrote in message
news:en******** ******@TK2MSFTN GP15.phx.gbl...
> 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 an

instance of
> the server and invoke the send() method?
>
>



Jul 21 '05 #5

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

Similar topics

0
1864
by: r_obert | last post by:
Hello, I'm trying to create a worker thread for my VC++ program, and was wondering whether I should be linking with the Multithread /MT or Multithread DLL /MD option? I'm not quite sure, in layman's terms, what the difference is. When I build with Multithread DLL, the linker complains about not being able to find a bunch of "unresolved external symbols" associated with nafxcwd.lib.
4
7090
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a incoming connection,the relative code snipprt as following:: private IPAddress myIP=IPAddress.Parse("127.0.0.1"); private IPEndPoint myServer; private Socket socket; private Socket accSocket; private System.Windows.Forms.Button button2;...
4
321
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 an instance of the server and invoke the send() method?
1
957
by: Terry Olsen | last post by:
Evidently the SmtpMail class doesn't throw an exception when the SMTP server returns an error? It just lets you happily think the email was sent when actually it was rejected by the SMTP server. I found this out by having my app connect to DevNull's Dummy SMTP server. Seems I was sending just the @domain part of the "FROM" address. Correcting that got my emails going. Now, how do I get the From to display a friendly name instead of my...
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10111
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7327
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
6603
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
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
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
3
2738
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.