In-Portal support 2 ways of sending e-mails:
- immediate - e-mail is sent immediately
- queued - e-mail is put into queue and then all queued e-mail are sent within next 30 minutes
By default all e-mails are sent immediately and this creates following problems:
- page, which caused e-mail sending, is frozen until e-mail is completely sent
- any fatal errors, that might happen during parsing e-mail template text result in user getting white screen
I'm proposing to:
- wrap e-mail template parsing in some sort of check code, that would:
- catch error if any
- write down this error into "System Log"
- don't send e-mail with parsing error
- allow code, that follows after e-mail sending to continue running
- send all e-mails asynchronously (e.g. put them into queue) with option to override this on per e-mail basis
- don't wait 30 minutes to send an e-mail, but rather send e-mail as soon as possible