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

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 1587
there are some commercial components that may provide better capability for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.com> wrote in message
news:en**************@TK2MSFTNGP15.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*******@hotmail.nospam.com> wrote in message
news:1m_td.468943$wV.356468@attbi_s54...
there are some commercial components that may provide better capability for multithreaded sending.

--- Nick

"Xerox" <an**@anon.com> wrote in message
news:en**************@TK2MSFTNGP15.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.com> wrote in message
news:e6**************@TK2MSFTNGP12.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*******@hotmail.nospam.com> wrote in message
news:1m_td.468943$wV.356468@attbi_s54...
there are some commercial components that may provide better capability

for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.com> wrote in message
news:en**************@TK2MSFTNGP15.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*******@hotmail.nospam.com> wrote in message
news:Iajud.547646$D%.137565@attbi_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.com> wrote in message
news:e6**************@TK2MSFTNGP12.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*******@hotmail.nospam.com> wrote in message
news:1m_td.468943$wV.356468@attbi_s54...
there are some commercial components that may provide better

capability for
multithreaded sending.

--- Nick

"Xerox" <an**@anon.com> wrote in message
news:en**************@TK2MSFTNGP15.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
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...
4
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...
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...
1
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. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.