SMTP mail, need way of making sure mail is sent

  • Thread starter Thread starter Curt_C [MVP]
  • Start date Start date
C

Curt_C [MVP]

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_C said:
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/
 
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
 
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/
 
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
 
Hi:
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
 
Back
Top