SmtpMail and queuing

  • Thread starter Thread starter John A. Bailo
  • Start date Start date
J

John A. Bailo

I use the SmtpMail object a lot to send notification emails from my program.

Today a firewall issue on my Linux sendmail server prevented programs
from connecting to it.

Question: Does smtpMail have any built in retry mechanism? Or can it
queue mail? Or is the an additional program that allows mail to be
queued and persisted if it can't get an outbound connection...
 
John said:
I use the SmtpMail object a lot to send notification emails from my
program.

Today a firewall issue on my Linux sendmail server prevented programs
from connecting to it.

Question: Does smtpMail have any built in retry mechanism? Or can it
queue mail? Or is the an additional program that allows mail to be
queued and persisted if it can't get an outbound connection...

What about a local mail server that relays the messages? You can dump
everything on it quite quickly, and it'll send them out in it's own
time, retrying as it needs to. Just enabling the mailserver in IIS (and
allowing relaying from the local host, or the machine that runs your
app) would do.

Alternatively, if you want something designed more for this kind of
thing, my company uses EasyMail SMTP Express
(http://www.quiksoft.com/smtpexpress/), which supports some cool
features like "mail-merging". We can give it a single message body
(populated with merge fields) and a DataSet, and it deals with sending
the thousands of messages in its own time. You can configure where
failures go etc., retry periods, and maximum connections.

HTH,

Danny
 
AFAIK in Framework 1.1 there was no such ability. You had to organize your
own message queue and exception handling on failure.

In Framework 2.0 there was introduced new class SmtpClient (
System.Net.Mail ). It has several options for delivery. For example
SendAsync.
With this method it is quite simplt to implement reentry mechanism.
If you have IIS in your disposal you can specify DeliveryMethod property,
where you can tell SmtpClient to use your IIS to send mail.
 
Excellent!

Question: Can I upgrade to Framework 2.0 if I have been using VS.NET
2003 with 1.1?

Can I run both frameworks simultaneously?
 
Danny Tuppeny wrote:

You can. You'd need to recompile your application.

So have 1.1 and 2.0 installed, but recompile using a path to the 2.0 csc
compiler.
If you don't have
VS2005, you can get free Express versions if you don't like using the
command line!

My application is a windows service -- I didn't think those were supported
by the Express. Anyway I put in a request for VS2005 to my manager...it's
still not clear to me if its available in release form and what the upgrade
cost is! (I have two Enterprise Architect licenses.)
 
Danny Tuppeny wrote:

What about a local mail server that relays the messages? You can dump
everything on it quite quickly, and it'll send them out in it's own
time, retrying as it needs to. Just enabling the mailserver in IIS (and
allowing relaying from the local host, or the machine that runs your
app) would do.

I thought about that but my experience with the IIS smtp server has been
very negative. It's a reall resource hog, and the smarthost feature never
seemed to work well.

But, mostly, I think its just removing the problem one level back -- because
the issue would be what if someone turns off the IIS smpt server -- the
program has no recourse but to lose the mail. So I really need a system
that has (a) retry and (b) persistence.

Alternatively, if you want something designed more for this kind of
thing, my company uses EasyMail SMTP Express
(http://www.quiksoft.com/smtpexpress/), which supports some cool
features like "mail-merging". We can give it a single message body
(populated with merge fields) and a DataSet, and it deals with sending
the thousands of messages in its own time. You can configure where
failures go etc., retry periods, and maximum connections.

Wow..I'll take a look at that.
 
John said:
But, mostly, I think its just removing the problem one level back -- because
the issue would be what if someone turns off the IIS smpt server -- the
program has no recourse but to lose the mail. So I really need a system
that has (a) retry and (b) persistence.

I think this depends how you pass mail to IIS. Rather than connecting to
it as SMTP, you can write to the pickup folder (like I think CDONTS
does), which means once IIS is started again, it'll pick up all the mail
that's been written.

Wow..I'll take a look at that.

We've not had any problems with it, and we now use their BounceBuster
software too. We've had a few problems (mainly down to not keeping up to
date with more recent versions!), and their staff have been very
helpful. I can't say there aren't better/cheaper alternatives out there
though, because it's the only one I have experience of!
 
John said:
So have 1.1 and 2.0 installed, but recompile using a path to the 2.0 csc
compiler.

Yep. I'm not sure if you can make VS2003 compile against 2.0, but you
can do it from a command prompt if not. If you open your project with
VS2005 (or an Express product) it'll try and "convert" it. I'm not sure
exactly what it does, but I've had success with it, and had to change
very little to make things compile/run in 2.0 :)

My application is a windows service -- I didn't think those were supported
by the Express. Anyway I put in a request for VS2005 to my manager...it's
still not clear to me if its available in release form and what the upgrade
cost is! (I have two Enterprise Architect licenses.)

I've not looked in detail, but one of the projects I opened in Visual C#
Express which was "upgraded" was a Windows Service. It didn't throw any
compile errors, but I didn't try installing the service (I was just
testing to see how hard it'd be to migrate). Always worth a try (or a
Google), nothing lost since it's free :-)

Actually, this book:

http://www.quantumbooks.com/p/03INETN/0764589555

Says "Develop applications with Visual C# Express using Windows Forms,
ASP.NET, and Windows Services"

:)
 
Back
Top