PHP can send email but elgg site cannot.

Hello everyone, it's my first time to publish a topic and there's a issue with email. I love elgg! 

 

This example ElggDocs can send email but elgg site cannot. 

In setting.php:

$CONFIG->emailer_transport = 'sendmail';

More detail: elgg 3.3, MTA is mailx and smtps.

 

Thanks!

 

  • but elgg site cannot.

    How did you know about this?

    What's in your server log?

  • I simply use another email address to register(I opened the User Validation by Email). 

    Server log? Do you mean the log browser or diagnostics or PHP log?

  • Server log? 

    I've meant this.

    You also can enable the logs via Administration -> Site settings -> Debugging and Logging -> Log level: Log errors and warnings

  • There's no log in /var/log/httpd or /var/log/apache2 :(

  • I've found the log but which information do you want?

  • [Tue Aug 18 21:26:51.810993 2020] [proxy_fcgi:error] [pid 23387:tid 139845804082944] [client 111.199.12.249:1512] AH01071: Got error 'il: Unknown error  {"backtrace":["[#24] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/lib/notification.php:259","[#23] unknown","[#22] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/HandlersService.php:71","[#21] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/PluginHooksService.php:81","[#20] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:524","[#19] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:327","[#18] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:427","[#17] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/lib/notification.php:521","[#16] /www/wwwroot/sn.mydomain.com/mod/uservalidationbyemail/lib/functions.php:60","[#15] /www/wwwroot/sn....', referer: https://sn.mydomain.com/admin/users/unvalidated
  • Seems, you have an issue witth the hook/event object's handler.

    Do you have third-party plugins activated?

    If yes, deactivate them.

    Check the sending mail again and check the logs.

    Another possible reason is the server configurations. Perhaps, proxy.

  • And this

    ELGG.ERROR: Unable to send mail: Unknown error  {"backtrace":["[#24] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/lib/notification.php:259","[#23] unknown","[#22] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/HandlersService.php:71","[#21] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/PluginHooksService.php:81","[#20] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:524","[#19] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:327","[#18] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php:427","[#17] /www/wwwroot/sn.mydomain.com/vendor/elgg/elgg/engine/lib/notification.php:521","[#16] /www/wwwroot/sn.mydomain.com/mod/uservalidationbyemail/lib/functions.php:60","[#15] /www/wwwroot/sn....', referer: https://sn.mydomain.com/admin/users/unvalidated
    

    I've disable the html email handler and don't think I use proxy

  • Have you tried with any 3rd party plugins you might have added in addition to the plugins that are bundled with Elgg at least temporarily disabled? If you have edited any Elgg core file (which you should never do), try with the unmodified files. If you have added any lagnuage files (just a guess as you made a posting about the Chinese language files) try without them included in your Elgg installation (just to be on the safe side for testing as a wrong encoding might cause problems). Basically, test if emails are sent with an unmodifed Elgg installation.

    If you have

    $CONFIG->emailer_transport = 'sendmail';

    in your settings.php the server must have a MTA installed and correctly configured. As you mentioned that sending the test mail as described in the docs works, the mailserver should be correctly set up. But the question is: what is the site email address you have used for your Elgg installation? Is it using the same domain name as the domain of your server / Elgg site? If not, the mailserver might deny sending the mail (for security reasons, i.e. anti-spam). What's the mail address shown as "FROM" address in the test mail? Can't you use this if it's different from your site email or can you create a mail address with your domain name if you're not doing so yet?

    The other option (if using a site email address with another domain) might be to change to

    $CONFIG->emailer_transport = 'smtp';

    and then also configure the $CONFIG->emailer_smtp_settings settings array in settings.php. That is you could try SMTP if the mail provider you might use a mail address from supports SMTP.

  • Thank you.

    Smtp is not available since my host closed port 25, but port 465 is ok.

    I've tried send test mail through this php test http://learn.elgg.org/en/3.x/appendix/faqs.html#missing-email and it works well. So I don't think it is because of MTA or SMTPS server error.

    No 3rd party plugins and I've never edit core (any files in vendor). I'll try to recover the vendor folder and delete language files in order to make sure of that.

    Is there any information in error log?