Doing CFOUTPUT/CFMAIL is a huge performance hit, so you don't want to do it
that way.  We manage mailing lists of pretty significant size, and we use a
combination of fairly aggressive validation at insertion time, and at send
time, we error check the list with a simple RE that every address must
validate against (the same RE is used as the final step of insertion
validation).  Here's some example code:

<cfquery ... Name="get">
  SELECT name, email
  FROM recipients
</cfquery>

<cfset emails = arrayNew(1) />
<cfloop query="get">
  <cfif Refind(email_re, email) EQ 1>
    <cfset arrayAppend(emails, email) />
  <cfelse>
    <cfset arrayAppend(emails, "") />
  </cfif>
</cfloop>
<cfset queryAddColumn(get, "email2", emails) />
<cfquery dbtype="query" name="get">
  SELECT *
  FROM get
  WHERE email2 <> ''
</cfquery>
<cfmail query="get" ....>
</cfmail>

> -----Original Message-----
> From: Burns, John D [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 25, 2004 11:29 AM
> To: CF-Talk
> Subject: Mailing to email list using CF
>
> I'm storing a list of users who have signed up for an email list in a
> database.  I have a simple web app for users to use when they want to
> send something to their email list.  When they click send, I'm using
> <cfmail query="blah"> to send the mail out to all of the users
> individually.  The problem I've run into is that CF has choked on
> invalid email addresses (legacy ones that have been brought to me from
> other databases) and when that happens, CF produces an error
> and quits.
> I thought about doing <cfoutput query="blah"><cfmail
> to="#email#...></cfoutput> but I'm fairly sure that takes some serious
> performance hits or else there wouldn't be the query attribute to
> CFMAIL.  Is there any way to tell CFMAIL to keep processing and just
> skip the invalid address?  I'm guessing that a cftry/cfcatch
> block will
> only catch the error and move on but will not tell CF to finish the
> mailing.
>  
> Any ideas? thoughts? Rants? etc?
>  
> John
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to