4 Replies Latest reply on Jun 19, 2009 11:28 AM by craigkaminsky

    cfmail "failto" not working with non-existent internal email addresses

    griphold Level 1
      We've hard-coded cfmail TO value in many places across many applications, i.e.
      <cfmail to="user1@abc.com;user2@abc.com;user3@abc.com" ...>

      Suppose when one of the users (user1,user2, user3) left company and his email address was removed from the MS Exchange server, cfmail would fail saying

      A problem occurred when attempting to deliver mail.This exception was caused by: javax.mail.SendFailedException: Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 550 5.1.1 User unknown

      in the server exception log and cfmail wouldn't report the error to the email address of "failto".

      So I'm wondering if it's possible to have cfmail ignore the bad one(s) and continue to send the email? Or is there anything I should do with the Exchange server?

      Advice is much appreciated.
        • 1. Re: possible to have cfmail report on non-existent email address
          Dan Bracuk Level 5
          That's not how it works. All cold fusion does is produce a mail file and put it into a spool directory. Then the mail server takes over.

          To find out about non-existent email addresses, put a failto attribute in your cfmail tag. That address will receive the delivery failure report. Then, you may be able to use cfpop to detect it and do something about it.

          To see for yourself, send yourself some mail but spell your name wrong.
          • 2. Re: possible to have cfmail report on non-existent email address
            griphold Level 1
            Thank you, Dan.

            Sorry, what I meant by "non-existent" is not quite straightforward. Let me explain this way:

            I observed the problem only occurred to emails of our company. For instance: our company's email address ends with @abc.com.
            my email address: kpolo@abc.com
            my previous colleague's address: john@abc.com (he's gone and the email is invalid / deactivated now)
            my client's email: lemon@xyz.com (used to be valid)
            If I code this way:
            <cfmail to="lemon@xyz.com" failto="kpolo@abc.com"...>

            "failto" does work and I got the email.

            but if these:
            <cfmail to="john@abc.com" failto="kpolo@abc.com"...>
            <cfmail to="lemon@xyz.com;john@abc.com" failto="kpolo@abc.com"...>

            I never got emails reporting the failure but error lines in the mail log and the exceptions log which read:
            "Error","scheduler-3","01/28/09","11:55:32",,"Invalid Addresses"
            "Error","scheduler-3","01/28/09","11:55:32",,"Invalid Addresses"
            javax.mail.SendFailedException: Invalid Addresses;
            nested exception is:
            com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown

            at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
            at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
            at coldfusion.mail.MailSpooler.deliver(MailSpooler.java:832)
            at coldfusion.mail.MailSpooler.sendMail(MailSpooler.java:731)
            at coldfusion.mail.MailSpooler.deliverStandard(MailSpooler.java:1021)
            at coldfusion.mail.MailSpooler.run(MailSpooler.java:986)
            at coldfusion.scheduling.ThreadPool.run(ThreadPool.java:201)
            at coldfusion.scheduling.WorkerThread.run(WorkerThread.java:71)
            Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown

            at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)
            ... 7 more
            • 3. Re: possible to have cfmail report on non-existent email address

              Were you able to get this resolved? I'm having a similar issue with the failto attribute.

              • 4. Re: possible to have cfmail report on non-existent email address
                craigkaminsky Level 3

                I've got a function on CFLib that verifies the existence of an email address. This function does not validate the email, it verifies that the inbox exists on the server, returning true or false accordingly. It passes the email address to a web service for the verification.



                I've got a beefier version of this same function on my projects page, with email verification, error handling, etc. The one that's on CFLib was done quickly and in response to a question previously posted on this forum. I then spent a little more time building it up for use in a few apps:



                You could use this function to check whether or not an email actually exists and then act accordingly.


                For the failto, I think you might have trouble with this attribute in your scenario. When you read the LiveDocs, the failto attribute is described as the:

                Address to which mailing systems should send delivery failure notifications. Sets the mail envelope reverse-path value.


                It may be semantic and I might be off-base, but I wonder if CF sees a difference between a 'delivery failure' and a 'non-existent' email. This may not be the case but it jumped out at me as I re-read the attribute description.