473,698 Members | 2,334 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 1606
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
1862
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
7081
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
955
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
8674
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
8603
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
9157
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
8895
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,...
0
7725
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
6518
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...
1
3046
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
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.