views:

347

answers:

2

I have a cfmail sending out to approxiamately 8 people (dynamically). One of these addresses is incorrect and therefore the whole email is not sent out. Is there any settings in the coldfusion administrator or in the cfmail tag where this can be changed so it will send to the 7 correct people and only fail for the one person. I'm using CF8.

+5  A: 

Old school:

<cfloop query="mails">
  <cftry>
    <cfmail from="#from#" to="#to#">
      <!--- ... --->
    </cfmail>
    <cfcatch>
      <div>
        Mail not sent. #cfcatch.detail#
      </div>
    </cfcatch>
  </cftry>
</cfloop>
Tomalak
Thank you and yes I understand this is a possibility. However, I was looking for a solution that did not involve looping through the addresses. It seems to me that with every other mail client if you have x good and y bad then x will get sent and y will fail, they won't all fail. Do you (or anyone) know why Coldfusion has not followed this?
Jason
The answer is, IMHO, ColdFusion is not an E-Mail client. It is a procedural/imperative/oo programming language with email sending capabilities. And sending mail is one step, as far as CF is concerned. It would even be harder to debug if it worked 90%, instead of failing as a whole. Try to employ some basic validity checking to the e-mail addresses beforehand. Nothing fancy, just so much that a bogus address fails at the mail server for being undeliverable and not in your app for being invalid.
Tomalak
+1  A: 

You can preprocess the list of emails with IsValid() and remove any items from the list that fail.

ryber
The email has the right syntax, it just does not exist
Jason