0
votes

In my project I am using <cfmail> to send an order confirmation to a user after successful creation of an order. I have got one doubt. If the mail server goes down during that time is there any way to handle that situation with cftry and cfcatch, or doesn't it handle those errors?

1
If the problem is with the mail server, what would you put in your cfcatch? - Dan Bracuk
@DanBracuk: I think we can log it somewhere, so that it will help us to detect whether the mail sent successfully or not? - user3427540
Well at least you didn't say that you would have notified someone because that would have involved mail. However, if you can look at log files, you can also look at the contents of the spool and undeliverable files. That might involve less time and effort. - Dan Bracuk
@DanBracuk: Yes you are correct. Still just want to know is it a correct way to generate exception by adding spoolenable=false for generating exception when mail gets undelivered due to any reason? - user3427540

1 Answers

1
votes

Normally if spoolenable is enabled the email will go to the spool and the page processes whether the mail actually gets sent or not as long as all the required fields are entered and valid.

https://wikidocs.adobe.com/wiki/display/coldfusionen/cfmail

Spool Enable details from Wiki

spoolenable Optional

Whether to spool mail or always send it Immediately. Overrides the ColdFusion Administrator Spool mail messages to disk for delivery setting.

yes: saves a copy of the message until the sending operation is complete. Pages that use this option might run slower than the ones that use the No option.

no: queues the message for sending, without storing a copy until the operation is complete. If a delivery error occurs when this option is No, ColdFusion generates an Application exception and logs the error to the mail.log file.