Handling invalid recipient in mailing list

11 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 6:11:56 PM4/2/15
to ColdFusion Technical Talk

I am trying to send a mass mailing to a somewhat carelessly created list of
contacts using e-mail addresses which were not verified at the time of
entry. Whenever the cfloop tag comes to an erroneous recipient, it quits and
throws an error. Is there anything I can do to the code to make it keep
going?

Here's the code:

<CFLOOP list="#Form.SelectedRecipients#" index="Recipient">
<CFMAIL
from="#Form.Sender#"
to="#Recipient#"
subject="#Form.Subject#"
type="HTML"
>
<html><head><link rel="stylesheet"
href="http://www.northgoods.com/global.css" type="text/css" /></head><body
bgcolor="black">
<table width=800 align="center">
<TR>
<TD align="center" colspan=2>
<table width=800 align="center" border="4" cellpadding="10"
bgcolor="black"><tr><td>
<strong><font face="Arial" size="+1" color="##FF6600">
#Form.Message#
</font></strong>
</td></tr></table>
<table align="center">
<tr><th colspan="2"><strong><font face="Arial" size="-1"
color="##FF6600">If you would like to be removed from<br>our mailing list,
please click here:</font></strong><br>
<a
href="http://www.northgoods.com/unsubscribe.cfm?delEmail=#Recipient#"
title="UNSUBSCRIBE"><font face="Arial" size="-1"
color="white"><strong>UNSUBSCRIBE</strong></font></a><br>
<font face="Arial" size="-1" color="##FF6600">You will receive one last
message from us to confirm your removal from our
list.</font></strong></th></tr>
</TABLE></body></html>
</CFMAIL>
</CFLOOP>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360350

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 6:17:22 PM4/2/15
to ColdFusion Technical Talk

You may want to add a cftry/cfcatch (around the cfmail block) so when
the error occurs it can be handled gracefully via cfcatch (like tagging
the recipient record as having a bad address) and the loop will keep
going - valid recipients get their mail and the others can be cleansed
from the list ;-)

HTH

Cheers

*Bryan Stevenson*B.Comm.
President & CEO
Electric Edge Systems Group Inc. - makers of FACTS™
phone: 250.480.0642
cell: 250.920.8830
e-mail: br...@fisheryfacts.com <mailto:br...@fisheryfacts.com>
web: www.fisheryfacts.com <http://www.fisheryfacts.com>

------------------------------------------------------------------------

Please consider the environment before printing this e-mail

-----CONFIDENTIALITY------
This message, including any attachments, is confidential and may contain
information that is privileged or exempt from disclosure. It is intended
only for the person to whom it is addressed unless expressly authorized
otherwise by the sender. If you are not an authorized recipient, please
notify the sender immediately and permanently destroy all copies of this
message and attachments.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360351

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 6:18:52 PM4/2/15
to ColdFusion Technical Talk

Dave,

A) What is the error. Fixing the error will keep your loop going.
B) Using a try/catch INSIDE the loop will allow you to keep it going - with
the caveat that you will miss whatever email throws the error so you might
want to log that inside the catch.

-Mark
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360352

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 6:24:04 PM4/2/15
to ColdFusion Technical Talk

<cftry>

Run you CFMAIL..

<cfcatch>Mark email bad in database</cfcatch>
</cftry>



-----Original Message-----
From: Dave Long [mailto:da...@northgoods.com]
Sent: Thursday, April 02, 2015 5:12 PM
To: cf-talk
Subject: Handling invalid recipient in mailing list


Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360353

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 6:55:18 PM4/2/15
to ColdFusion Technical Talk

Thanks to all. The scheme worked perfectly. Next I will have to warn my
recipients that a test is coming so I can remove invalid recipients.

Unless maybe you can suggest a method to delete them as they occur. I intend
to add a confirmation message requirement to our contact form, which should
have been there all along, but a means of automatically cleaning the
existing mailing list would help everyone... me most of all though.

Thanks again for your help.

Dave Long
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360354

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 8:32:41 PM4/2/15
to ColdFusion Technical Talk

Dave,

You could have your code 'automatically' scrub the list and use a 'log' to
keep track of the changes. This way you won't have to do a test run.
Also, you could set up your code on a 'dummy' email server that will send
the email but trap it prior to being mailed, this way you don't have to
bother your recipients list.
Also, you could create an email validation loop so that you can 'verify' the
list without the concern for sending an email out at all (instead of doing a
'cfmail' tag, you would do the validation of the email address).

I don't know how large your recipient's list is, but I would try to not
bother them with testing emails.

Just my 2 pence,
William


----------------------------------
William Seiter
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360355

hofar...@houseoffusion.com

unread,
Apr 2, 2015, 9:08:26 PM4/2/15
to ColdFusion Technical Talk

You probably know already, but I'll say it just in case ... you can rarely
have a 100% clean list. I have found that even after you just clean up
a list, your next mailing will have rejects in it. Even if it's only a
few minutes since you last cleaned it up.

Your error handling needs to be able to differentiate between temporary
problems (e.g. mailbox full) and permanent problems (e.g. that user not
known here) . Your block of ip addresses can be blocked if someone in
the same data centre gets flagged as a spammer. And that can be only
transient too, so next time you try to bulk email some of the ones that
were rejected as "sender address blocked" are not rejected now.

Then there are the ones that are rejected because their mailbox is full.
It might be full because it's an inactive email address (i.e. permanent) ,
or simply that they have been on vacation and havent picked up email for a
while (i.e. temporary). Or they might be in arrears with the credit
department at their email hosting service, which will be cleared again
once they pay their bill.

I usually flag bouncing email addresses but still include them in the next
couple of emails. If they bounce 3 times I consider them to be dead and
remove them from the list.


--
Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360356

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 8:20:08 AM4/3/15
to ColdFusion Technical Talk

Thanks so much to all and to Mike and William, I will be putting your advice
on the top of my list of things to do. The list in question has
approximately 5,500 names but, by the time it is cleaned up, will probably
be closer to 5,000.

The idea of not disturbing subscribers unnecessarily is most attractive.

Thanks again.

Dave
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360357

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 8:40:57 AM4/3/15
to ColdFusion Technical Talk

Dave,

you can validate your email addresses automatically simply by using the
Likes of Mailchip, which will validate allthe email addresses when you
submit them and remove the bogus ones, it will also automatically remove
bounce addresses for you as well.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360358

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 8:51:30 AM4/3/15
to ColdFusion Technical Talk

The CFTRY and CFCATCH method described earlier is a great method for a
partial scrub. That method will scrub those email addresses which are
malformed or have invalid syntax. That's a great start, but there are two
additional things you should do as well:



1. Use the FAILTO feature of the CFMAIL tag and send the failed mail
to an alternate return address. This will allow you to identify the mail
where the email address has a valid syntax but is undeliverable. Of course,
you'll need to parse through the mail to see why it's undeliverable based on
the system messages. Some will be hard failures which are undeliverable
because the email address is invalid or the account is discontinued. Those
are sure fire mails to remove. Others will be soft failures with messages
"mailbox full" or "temporarily unable to connect with server". Those are
suspect mails and if you keep a history of those, you may see some patterns
like a mail box which is always full. After several of those type returns
you can probably assume no one is collecting the mail and purge those as
well.



2. You should also be sure to provide an "Unsubscribe" option on the
mail. I'd assume you are most likely doing that as that's required by the
CAN SPAM ACT. You can hook that up to a query so people can just do it
themselves with no action needed from you.



When sending bulk mail to a mail list it's important that you clean the list
of failed mail and provide an opt-out option. Failure to do either could get
your mail server blacklisted. and that's a headache you don't want to deal
with. A high rate of failed mail and no opt-out feature will get you
blacklisted very quickly.



If you are going to this a lot, it's also a good idea you allow the mail so
spool (cfmail spoolenable="yes") and you may even want to write a trickle
program to slow down the outbound mail stream. If you have a bunch a mail
going to the same server (or servers) and you're not trickling the mail, the
server will try to send a bunch very quickly and your mail server could make
multiple connections to the other server. Too many concurrent connections is
another thing that's sets of the SPAM alarms and could also get you
blacklisted.



Lastly, to ensure your mail does not go the SPAM box, be sure you test the
content in a SPAM RATING service. There are a lot of filters you can run
the mail content through and get a rating telling you how 'spamy' the mail
looks. There are a bunch of things they look - various trigger words like
FREE, BUY NOW, VIAGRA, etc., malformed HTML, too many pictures and not
enough text content, etc.



Hope this was helpful.





Robert Harrison

Full Stack Developer

AIMG

rhar...@aimg.com

Main Office: 704-321-1234 ext.118

Direct Line: 516-302-4345

www.aimg.com









~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360359

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:30:15 AM4/3/15
to ColdFusion Technical Talk

Hi Folks

Robert details all the steps to keeping an email list "clean and valid".
Having done that in the past and for a list of 5000 addresses I would say it is a
far better deal to go with one of the email newsletter companies. Having tried
several I can highly recommend mailchimp http://mailchimp.com/

They offer several benefits.

1. They clean the bounced email and keep the list valid. (no programing to write
and validate)

2. They have deals with ISPs to recognize their bulk email as legit. When I was
doing that privately it was a headache to stay on top of all the ISP's spam
protections and have my server continually validated. (And if you are on a
shared server forget it as you will be vulnerable to all the other user's bad
practices and reputation)

3. The time saving was well worth the $s

4. If you do decide to use a provider check their rules about establishing your
list. (some such as icontact will require you to do a new optin on your already
established list, and then they will block anyone who does not "re-optin". Those
address could then never be resubsbcribed even by their owner.)

Rob
Robert J. Voyle, Psy.D.
Director, Clergy Leadership Institute
For Coaching and Training in Appreciative Inquiry
Author: Restoring Hope: Appreciative Strategies
to Resolve Grief and Resentment
http://www.appreciativeway.com/
503-647-2378 or 503-647-2382




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360360

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:35:58 AM4/3/15
to ColdFusion Technical Talk

+1 for Mail Chimp. I was preparing to post about this but Robert did
a better job of explaining than I could. I never use anything but
Mail Chimp for bulk mail sends.

On Fri, Apr 3, 2015 at 10:29 AM, Rob Voyle <robv...@voyle.com> wrote:
>
> Hi Folks
>
> Robert details all the steps to keeping an email list "clean and valid".
> Having done that in the past and for a list of 5000 addresses I would say it is a
> far better deal to go with one of the email newsletter companies. Having tried
> several I can highly recommend mailchimp http://mailchimp.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360361

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:37:18 AM4/3/15
to ColdFusion Technical Talk

It is true that using a service like Mail Chimp to validate a mail list is
an easy way to validate a mail list, but the steps I detailed are a valid
alternative for any full blown system you may be managing.

I've written systems that have opt-in, opt-out features and utilize a
variety of merged lists, like customer lists, prospect lists, interest
lists, etc. These are lists which are constantly changing based on user
actions and other factors. If you're managing a dynamic, living list, those
steps probably are the most valid. For one-offs, the service, as you
suggest, is probably the best solution.


Robert Harrison
Full Stack Developer
AIMG
rhar...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360362

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:42:07 AM4/3/15
to ColdFusion Technical Talk

> I never use anything but Mail Chimp for bulk mail sends

Honestly, I too highly recommend a service like Mail Chimp or Constant
Contact, or Emma. They clearly have their place and the headache of getting
blacklisted is miserable, but sometimes you have a situation where the
options and functions are built-into and integrated with the core site (or
sites). In that case it may be best to 'roll you own' as they say.

Thanks

Robert Harrison
Full Stack Developer
AIMG
rhar...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360363

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:45:37 AM4/3/15
to ColdFusion Technical Talk

You can also utilize a tool like BoogieBounce by Boogie Tools (
http://www.boogietools.com/). I've used this in the past and it works
great. It allows you to determine the cause of a rejected email (hard
bounce, soft bounce, server unreachable, etc.) and then programmatically
deal with it as needed. I would agree though, over the years I have
switched to using 3rd party mailing services for lists, as the number of
man-hours and headaches caused by managing the email are not worth it.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360364

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:50:21 AM4/3/15
to ColdFusion Technical Talk

I agree that using a third part service is highly desirable, but depending
on the integration and the client it may not be feasible. I clearly have
clients that would never allow their mail list or the mail content to be
placed on any third-party server for compliance and/or security reasons...
real or perceived.

Robert Harrison
Full Stack Developer
AIMG
rhar...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360365

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 10:51:47 AM4/3/15
to ColdFusion Technical Talk

Have any of you tried Amazon SES for email? I paid to clean my list and then started using them.
I can send out 20,000 emails for $2. It’s so much cheaper. I do use a software program called Sendy
in conjunction with Amazon which cost $50 (one time).

Just thought I’d mention it, but it’s about 2% of the cost to send emails.

Kelly
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360366

hofar...@houseoffusion.com

unread,
Apr 3, 2015, 1:18:38 PM4/3/15
to ColdFusion Technical Talk

Hi guys,

I have a rule of thumb. NEVER DELETE ANY DATA. Be it an obsolete email, a diseased customer, etc. I just flag the as NOT TO BE USED. This is because over time, someone may decide to activate that data and become your next biggest buyer.

Also, with respect to newsletters, I have over 17,000 emails in my list. (I know its not as much as yours), but after spending so much with the likes of icontact and campaign monitor, I decided to get ingenious. So I segmented the list into minor groups of 2,000. Then I churned our this flow in my code:

1. Select all from list table, but group by list name- this is so I can select which list to sent to at a time.

2. Put selected list(s) in a table, then loop through each list one by one, confirming:

a) if there are valid emails, using the inValid function, else, isolate (don't delete)

b) last contact we had with it. This is to watch out for excessive newsletters sent to a particular email weekly

c) etc

3. Loop through emails and Send newsletters to each in the batch, using page refresh. By this, I can send to as much as 100 emails in every 10 seconds.

Well, its old fashioned, but I get to save newsletters marketing funds. 

Hehe ;)



Best regards,
Chuka Anene
www.Quorium.org

Sent from Samsung tablet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360370

hofar...@houseoffusion.com

unread,
Apr 4, 2015, 9:03:50 AM4/4/15
to ColdFusion Technical Talk
Reply all
Reply to author
Forward
0 new messages