You would use SMTP only if you can't (or do not want) to set up an MTA (e.g. postfix) on your server. If the mailserver is correctly set up on your server Elgg can likely make use of it without any configuration necessary. When sending mail from your own mailserver it might be necessary to use a from mail address (site email) from the same domain and maybe also some authentification functionality is necessary for your mails not getting blocked by mail providers (sender server domain and mail domain being different is not very trustworhty after all).
I don't know what the rules regarding mail address domains are with SMTP. But I would imagine that a mail provider offering sending mails via SMTP over their servers would not like being miused by spammers either and therefore will requite usage of a mail address of their domain.
That's right iionly. There are too many issues with SMTP being blocked from my VPS. So I am using a third-party SMTP service called mailgun which works very well and comes with some great reporting and management tools.
I'm using mailgun for another two websites that I admin, which also run on the same VPS, so I know that the configuration works just fine.
However, for some reason Elgg is not communicating correctly with mailgun. I've checked the logs on mailgun and I can not see any rejected emails or anything like that so having isolated everything else to the best of my ability I have to assume that the problem is with Elgg's implementation of sending mail via SMTP.
When I get some time I'll look at the code (hooray for open source) but I'm no expert on PHP/Zend. If I do come up with a solution I'll feed it back in the comments. I do like the layout and functionality of Elgg so I'll do a bit more work to try and get the email working before I junk it for something else.
It has been a long road figuring out how to solve this problem so I figure I may as well post my solution for those who come after me.
Please bear in mind that I'm in no way an expert linux admin so what I'm about to say may seem obvious to others.
What I didn't realise is that postfix can be used to relay mail to a third-party SMTP service rather than trying to send it directly. There are some instructions and a sample config on this page:
So what I did was the following:
I hope this helps someone out there avoid some frustration and good luck!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.