Skip to main content
June 11, 2006
Answered

Authenticate Email address

I seem to remember a tag that would authenticate an email address. problem i am having is when spooling thru large list on send, bad email address causes error and stops send.

tnx in advance.
    This topic is closed to new replies. Start a new post to keep the conversation going.
    BKBK
    BKBKCorrect answer
    Community Expert
    June 12, 2006
    need to catch within "cfif emailaddress is bummer" (sorta) as emailing from dynamic list via scheduled (late-nite, not monitored) and error at that point becomes doozy.

    say what?

    I seem to remember a tag that would authenticate an email address.
    Use validation code like CF_output's (CF_output = forum member). There is also the MX7 function, isValid(). Use it to validate an address before it goes into the cfmail tag.

    bad email address causes error and stops send
    This suggests you should change your code logic, for one bad address should not cause the whole sending process to stop. Use try-catch to trap exceptions, enabling code execution to continue.

    13 replies

    BKBK
    Community Expert
    Community Expert
    June 13, 2006
    an excel file with over 40K listings
    A list of e-mail addresses? Then just write a CFM script that reads the file and validates the addresses, discarding the bad ones.






    Translate
    BKBK
    Community Expert
    Community Expert
    June 12, 2006
    The best time and place for validation is, of course, before the addresses are stored in the database. You could implement such a scheme for new addresses. For the addresses already in the database, you could run a scheduled job to validate them, marking or removing the invalid ones.

    Translate
    June 12, 2006
    SafariTECH... Is true that validation on submission would be better and i will probably work that into client sites but this project, was given an excel file with over 40K listings...

    tnx
    Translate
    BKBK
    Community Expert
    Community Expert
    June 12, 2006
    !
    Translate
    Inspiring
    June 12, 2006
    You should probably change the form where they sign up so it validates the email at that point, then you wouldn't need to validate the address at the time of mailing.

    It's more efficient to have the application validate ONE address, then have to have it validate every address each time you run the mailer.
    Translate
    Participating Frequently
    June 11, 2006
    Ranger,

    There are 2 checks that can be done to email addresses.

    1) is this email address well-formed? CF_output's code will test for this. This test passing doesn't mean that an email to the given address will be successful, it just means that the email address conforms to the specifications of how an email address is supposed to look.

    2) is there actually an account associated with this email address?

    The only way to 100% test number 2 is to send an email to each address with a link in it. When the user on the other end clicks on the link, you can then flag the email address as both valid syntax and an actual, live email address. There are ways to get some of the way there without user intervention, but none of them are 100% guaranteed (as email servers have gotten less and less verbose in their responses).
    Translate
    June 12, 2006
    You can do pretty good checks on email addresses as you send.

    See Paul's answers in this thread:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=7&threadid=1010808#3621617
    Translate
    June 11, 2006
    I think something like this should take care of it. Just edit this to fit your needs - run it through a loop, and update your list.

    <cffunction name="isEmail" returntype="boolean" access="public"
    output="false" hint="I test passed value to see if it is a valid e-mail
    address (supports subdomain nesting and new top-level domains).">
    <cfargument name="str" type="string" required="true" hint="I am
    the string to test." />

    <cfscript>
    var isOK = false;

    //supports new top level tlds
    if (
    REFindNoCase("^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.
    (([a-z]{2,3})|(aero|coop|info|museum|name))$",
    arguments.str) ) {
    isOK = true;
    }

    return isOK;
    </cfscript>
    </cffunction>
    Translate
    June 11, 2006
    it is an exsisting list of 45,000 email addresses in an msSQL table... as it only takes one to crash page, i need to make 100% sure address is right BEFORE it is entered into cfmail.
    Translate
    June 11, 2006
    well when you are inserting the emails into the database, you can always use validate="email". If the emails are already in the database - you can try using the replace function to remove blank spaces, commas, etc.... I've never tried it - but maybe testing out URL encode with the list?
    Translate