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

SMTP mail, need way of making sure mail is sent

Hi:

I'm working on an e-commerce site. Using the SMTP class, my site sends out
confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about
wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this
kind of thing?

Thanks,
Charlie
Nov 18 '05 #1
5 2470
can't
Since SMTP doesn't really have a response, since mail can be delayed, etc,
there isnt any good way to do that, even if you could, that wouldn't
guarantee they got it, or opened it, or read it, etc.....
E-mail really is more of a "hit send and hope it gets there" thing really.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Charlie@CBFC" <ch*****@comcast.net> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
Hi:

I'm working on an e-commerce site. Using the SMTP class, my site sends out confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this kind of thing?

Thanks,
Charlie

Nov 18 '05 #2
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in news:OKNdc7ZPEHA.272
@TK2MSFTNGP12.phx.gbl:
Since SMTP doesn't really have a response, since mail can be delayed, etc,
there isnt any good way to do that, even if you could, that wouldn't
guarantee they got it, or opened it, or read it, etc.....
E-mail really is more of a "hit send and hope it gets there" thing really.


You can build in a "confidence rate" though. And many will fail immediately
and you can certainly catch that.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 18 '05 #3
If you are saying the Send() method throws an exception then you don't want
to loop until it sends because you don't know how long that will take. What
you should do is have a backup mail server that you can try if the first
server fails. Another option if the SMTP server is on the same machine you
could spool the message directly to the pickup directory instead of using
the SMTP protocol. Doing this should increase the chances of the message
being delivered. If you can't get this working with System.Web.Mail then
you may want to take a look at a third party component that supports backup
SMTP servers like: http://www.quiksoft.com/objects/smtp/

Bill.
http://bill.atwill.com/
"Charlie@CBFC" <ch*****@comcast.net> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
Hi:

I'm working on an e-commerce site. Using the SMTP class, my site sends out confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this kind of thing?

Thanks,
Charlie

Nov 18 '05 #4
If your smtp mail server is on another server consider setting up smtp
virutal server on the same box as your web server (on your pc when
developing). Set the smtp virutal server to relay to the actual smtp mail
server (in win2003 virtual smtp this setting is the "smart host"). What
this will do for you is pretty much guarantee that your mail will always get
queued....as long as your web server is up and the smtp service on it is
running. The beneifit of this is that if the mail server is down or there
is a network disconnect the email will still queue locally until the mail
server is available again.

If you have the benefit of multiple mail servers you can set up your code to
round robin attempt to the different mail servers. For example, if you
attempt to send to mail server 1 and a try/catch error is raised then
attempt to send to server 2 and if server 2 is down...etc. I prefer to
attempt the local smtp server first as the general logic is that if it's
down the web site is *probably* down too. We've found, through heavy
testing, that we can actually loose some emails (they just disappear) if we
send directly to our mail server and either the email viruswall server
and/or the attempted smtp mail server is down...in some situations no error
is raised when this happens: something that took me days to prove out to
our networking staff. Yet in the same situation, if the email is queued
locally it stays queued until the mail server is up.

Don't know if that answers your question but hope it helps.
Brad

"Charlie@CBFC" <ch*****@comcast.net> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
Hi:

I'm working on an e-commerce site. Using the SMTP class, my site sends out confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this kind of thing?

Thanks,
Charlie

Nov 18 '05 #5
>> Hi:

I'm working on an e-commerce site. Using the SMTP class, my site sends

out
confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought

about
wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling

this
kind of thing?


Assuming you have access to your own mail server logs:
Write a program to check your mail server's operation log against your list
of outgoing addresses. This is an approach for testing at the end where it
actually goes out.

karim
Nov 18 '05 #6

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

Similar topics

5
by: Andreas | last post by:
I am working with three computers, my developing computer, a Web Server and a Mail Server (Exchange). I am trying to send a email from the Web Server via the Mail Server to a valid email address...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
9
by: Ted Boyd | last post by:
I have an ASP page that sends email using CDOSYS. If there is any type of failure that causes the email not to be sent, I don't have any way of knowing it. Is there any email component that will...
11
by: ibiza | last post by:
Hi all, I am trying to use the System.Net.Mail class for the first time, with ASP.NET 2.0. I setup everything according to http://www.codeproject.com/aspnet/EasySMTP_package.asp, which gives...
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
17
by: William Gill | last post by:
My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it. Does anyone know of a simple method of testing php scripts that...
9
by: mmm | last post by:
After reading about and using the smtplib module, I thought code such as below would ignore the 'Cc: ' body line below when sending messages and instead simply use the RECEIVERS list session =...
9
by: Keith G Hicks | last post by:
I have a vb app that runs on a server. It periodically checks for rows in a table that are ready to have data mailed out to clients. After it finds row(s) that are ready, it emails the info out and...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.