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

SmtpMail.Send with timeout

I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I get an exception
that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5 seconds) ?
Is there another solution for it (sending the mail in new thread ?) ?

Thanks

ra***@hotmail.com
Nov 17 '05 #1
6 2953
Ily
Theres not a lot you can do with the mail object sin Dotnet

You might be better looking at some third party component

Nov 17 '05 #2
but why ?
if she/he need to just do it asynchronously, why she/he need 3rd party
component?

The thread with event rised when the mail couldn't be send is a quite
good solution. But rather for WinForm. In the web the solution I know
is to put mail's in some queue (for example database or flat files with
mails). And use external service (windows service) to handle mail
sending.
If your web application will grow, then a lot of mails will be
generated, and only dedicated service would be able to handle it.

--
best regards
stic

Nov 17 '05 #3
..Net 2.0 has a SmtpClient.Timeout parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I get an
exception that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5 seconds)
?
Is there another solution for it (sending the mail in new thread ?) ?

Thanks

ra***@hotmail.com

Nov 17 '05 #4
It's a production application so I don't want to use beta.
BTW, when does .Net 2.0 final will be shipped ?
"William Stacey [MVP]" <st*****@mvps.org> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
.Net 2.0 has a SmtpClient.Timeout parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I get an
exception that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5
seconds) ?
Is there another solution for it (sending the mail in new thread ?) ?

Thanks

ra***@hotmail.com


Nov 17 '05 #5
Not sure, but VS2005 (w/ .net 2.0) has a go-live license if that helps. I
~think there may just be a RC and then RTM, so it is pretty close. Others
may have better info. Cheers.

"ra294" <ra***@hotmail.com> wrote in message
news:uq**************@TK2MSFTNGP10.phx.gbl...
It's a production application so I don't want to use beta.
BTW, when does .Net 2.0 final will be shipped ?
"William Stacey [MVP]" <st*****@mvps.org> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
.Net 2.0 has a SmtpClient.Timeout parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I get an
exception that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5
seconds) ?
Is there another solution for it (sending the mail in new thread ?) ?

Thanks

ra***@hotmail.com



Nov 17 '05 #6
nov 7, 2005
-- bruce (sqlwork.com)

"ra294" <ra***@hotmail.com> wrote in message
news:uq**************@TK2MSFTNGP10.phx.gbl...
It's a production application so I don't want to use beta.
BTW, when does .Net 2.0 final will be shipped ?
"William Stacey [MVP]" <st*****@mvps.org> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
.Net 2.0 has a SmtpClient.Timeout parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I get an
exception that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5
seconds) ?
Is there another solution for it (sending the mail in new thread ?) ?

Thanks

ra***@hotmail.com



Nov 17 '05 #7

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

Similar topics

3
by: Jimmy | last post by:
I am trying to send an attachment using SmtpMail. I am able to send an Excel or text file, but when I try to send a pdf file, it throws an exception: could not access CDO.Message object. The file...
2
by: Leszek | last post by:
Hello, I have created a simple code to send emails using the MailMessage class and the SmtpMail.Send() method: MailMessage mail = new MailMessage(); mail.From = echidna@somewhere.com; //...
3
by: JJBW | last post by:
Hi I am having a bit of a problem with SmtpMail. I have a bit of code that should send an email but when it is executed no email turns up. MailMessage mmNotify = new MailMessage(); ...
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. ...
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...
4
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP...
2
by: kmbarz | last post by:
I'm trying to expand my horizons here by working through an ASP.Net book. When I do the example that uses: Line 55: Mail.From = "feedback@graymad.com" Line 56: ...
6
by: ra294 | last post by:
I have an ASP.Net application that sends Emails on several pages. The problem is that when the mail server is down from some reason, the SmtpMail.Send hangs the application for one minute until I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.