473,732 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c om
Nov 19 '05 #1
6 3200
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.Time out parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail. com> wrote in message
news:uv******** ******@tk2msftn gp13.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.c om

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.o rg> wrote in message
news:Od******** ******@TK2MSFTN GP12.phx.gbl...
.Net 2.0 has a SmtpClient.Time out parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail. com> wrote in message
news:uv******** ******@tk2msftn gp13.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.c om


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******** ******@TK2MSFTN GP10.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.o rg> wrote in message
news:Od******** ******@TK2MSFTN GP12.phx.gbl...
.Net 2.0 has a SmtpClient.Time out parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail. com> wrote in message
news:uv******** ******@tk2msftn gp13.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.c om



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

"ra294" <ra***@hotmail. com> wrote in message
news:uq******** ******@TK2MSFTN GP10.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.o rg> wrote in message
news:Od******** ******@TK2MSFTN GP12.phx.gbl...
.Net 2.0 has a SmtpClient.Time out parameter. Can you use that?

--
William Stacey [MVP]

"ra294" <ra***@hotmail. com> wrote in message
news:uv******** ******@tk2msftn gp13.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.c om



Nov 19 '05 #7

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

Similar topics

3
1623
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 size is about 1.92 MB. I was wondering what could be the factors that result in such an exception. I am using C# .Net and Windows XP Pro. Thanks, Jimmy
6
2979
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 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 ra294@hotmail.com
2
2547
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; // hard-coded mail.To = platypus@somewhere.com; mail.Subject = "Test"; mail.Body = strMessage;
3
2017
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(); mmNotify.From = ; mmNotify.To = ; mmNotify.BodyFormat = MailFormat.Text;
5
2151
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
2698
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 e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
3
9256
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 e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
4
7551
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 SP2, and IIS's SMTP and WWW servers are installed. Here is the error trace: System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an...
2
1836
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: SmtpMail.SmtpServer = "localhost" Line 57: SmtpMail.Send(Mail) I get: myemail@comcast.net
3
1831
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 even though the other addresses are. I know the spelling is correct because I have tried sending messages from my other accounts to this address and have recieved them successfully. I also do not know of any junkmail filter that would delete the...
0
8946
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9307
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
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
9181
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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, and deploymentwithout 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...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
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
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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.