473,396 Members | 2,111 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,396 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 19 '05 #1
6 3189
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 19 '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 19 '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 19 '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 19 '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 19 '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 19 '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...
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...
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: ...
3
by: Nathan Sokalski | last post by:
I have an ASP.NET page that sends a Mail.MailMessage to several email addresses (all mine). However, one of the addresses, the one ending in @verizon.net, does not seem to be recieving the message...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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 projectplanning, coding, testing,...

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.