By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,280 Members | 2,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,280 IT Pros & Developers. It's quick & easy.

SmtpMail.Send with timeout

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
..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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.