ColdFusion email - is there a way to confirm the email has been sent?
Just using the standard cfmail tag, 开发者_如何学Pythonis there a way we can confirm that the email has been sent?
I tried cftry/cfcatch but that only confirms that there were no errors in processing the tag, if I put in an invalid mail server, it passes (but mail obviously doesnt send)
One hackish way, if do not have access to the logs, is to bcc an alternate address.
If it is not in the spool folder, and not in the error log, it has been sent.
see: Using ColdFusion with mail servers
You can always write a routine to check the mail log. That requires you to have access to the log files.
If you turn off spooling the messages to disk, they'll attempt to be sent immediately. Then you can trap with try/catch which should let you log any SMTP errors. If you don't get an error then you are reasonably assured that the message was sent successfully.
This may have negative ramifications for performance under load. It will also negatively impact the user experience as the user will be waiting for the SMTP negotiation that usually takes place in the background. You might then consider using CFTHREAD, but then why not just use the native spooling?
精彩评论