\cfusion\mail\undelivr

by marcus on 14/12/2004



You know that directory? Ever seen it? Well, if so, when was the last time you had a look at it… last week? Last month? Last century? Welcome to the club ;-)We all know that problem: if a cfmail tag is called to send out an e-mail, CF puts the generated cfmail-file into the spooler. If, for whatever reason, the mail cannot be sent, the file is moved to the undelivr-folder. Period.

If you also administer your server(s), you’ll probably check that folder once in a while, move the undelivered files back to the spooler and check back next time… or week/month/year/life. That generally results in sales persons asking “why the hell did that email need four month to be delivered???”. And hey, they’re even right!

At Henkel, we’re currently running a bunch of CF 5 and CFMX servers in several clustered environments. From time to time, the smtp gateways may be unreachable, and even though we’re checking email address entries before doing a cfmail, some very eager persons manage to misspell them…

To sum it up: I decided to write a template that does the dirty work for me:

  • Move all files from the undelivr-folder back to the spooler
  • Keep track of them in a database
  • Log that action
  • Count how many times each mail file has been moved back
  • If not sent out for 10 times, move it to a “junkyard” folder

If a mail failed to be sent out for 10 times, there’s probably something wrong with the mail address. Assuming I call the template every 12 hours, a 5-day-timespan is covered, and most likely (or hopefully) the smtp gateway is NOT the reason after five days of sending in vain 😉

So give it a try – originally designed to work on the Henkel systems, I did a quick rewrite of the code to make it work on standard CF machines.

Let me know if it works for you!

Download file

Update: V1.10: Fixes for CFMX7

Amos October 26, 2005 at 12:00 am

Hi,

Your script is great, just 1 probleme, script SQL don’t match on SQL Server

See you later
Have a nice day

David Collie January 17, 2006 at 12:00 am

Just thought I’d leave a note to say now running on our dev and test servers with very little intervention (twweaked it to work on Unix). Nice work!

Comments on this entry are closed.

Previous post:

Next post: