snytkine / LampCMS

Open source Question and Answer program similar to StackOverflow and Quora in PHP + MongoDB. Follow @snytkine on Twitter
http://support.lampcms.com
323 stars 104 forks source link

Use SwiftMailer for all email functions #78

Closed snytkine closed 12 years ago

snytkine commented 12 years ago

Include the SwiftMailer lib with the application. The SwiftMailer is LGPL v3 just like Lampcms, so including it will not be a problem. Also since we already using Mail/Mailer as Mail class it will be easy to just modify its method to use Swift, even include all Swift classes as dependency when instantiating Mailer via Registry.

The only downside is that when we email admin on errors using php's mail function means there are fewer dependencies (none other than correctly setting mail params in php.ini)

In case of serious error like a config error or library path not found we will not be able to instantiate the Swift Mailer and will not be able to email anything.

We can start a MAIL_QUEUE collection in DB to queue outgoing messages but it will not work if error has to do with library path is incorrect or if cannot connect to DB.

Using php's native mail() is still the most reliable way to email errors to admin as long as php.ini is configured correctly and as long as outgoing smtp server does not require authentication.

For sending out regular emails (not error notifications) Swift Mailer is a good option and could be better than php's own mail() especially when dealing with SMTP that requires authentication (typical case when on Windows server)

snytkine commented 12 years ago

Done