Getting validation email to work in Elgg 4.1 ?

I've got problems with Elgg sending any emails. Previously I've simply used something like this:
https://elgg.org/plugins/2420835
which works right away when I feed it the SMTP-info but with Elgg's php-config file, sending email doesn't work. Here's one example configuration that doesn't work:

/**
* Configure emailer transport
*
* This setting can be used to select a different emailer transport. By default the Laminas Sendmail Transport is used.
* Currently only 'smtp' and 'sendmail' are supported as a different configuration.
* For 'smtp', the SMTP server's settings must be set, while 'sendmail' requires no configuration.
*
* @global string $CONFIG->emailer_transport
*/
//$CONFIG->emailer_transport = 'sendmail';

/**
* Configure sendmail related settings
*/
$CONFIG->emailer_sendmail_settings = 'smtp';

/**
* Configure emailer SMTP settings
*
* This setting is only necessary if the above emailer transport is set to 'smtp'.
* Please refer to https://docs.laminas.dev/laminas-mail/transport/smtp-options/#configuration-options
* and https://docs.laminas.dev/laminas-mail/transport/smtp-authentication/#examples
*/
$CONFIG->emailer_smtp_settings = array(
 'name' => 'localhost.localdomain',
 'host' => 'smtp.mydomain.com',
 'port' => 25,
 'connection_class' => 'login',
 'connection_config' => [
 'username' => 'my_username',
 'password' => 'my_password',
 'ssl' => '', // OPTIONAL (tls or ssl)
 'port' => '', // OPTIONAL (Non-SSL default 25, SSL default 465, TLS default 587)
 'use_complete_quit' => '', // OPTIONAL
 ],

);


I'm trying to use SMTP because for some reason, sendmail doesn't work on Elgg for me. However when I do this test:
http://learn.elgg.org/en/stable/appendix/faqs.html?highlight=email#missing-email
I receive email just fine.

PS. If I uncomment the:

//$CONFIG->emailer_sendmail_settings = '';

...line, and give another try with sendmail, what am I supposed to insert into the brackets?

  • When using SMTP you would have to uncomment and change

    //$CONFIG->emailer_transport = 'sendmail';

    to

    $CONFIG->emailer_transport = 'smtp';

    I think it won't use SMTP otherwise at all regardless what you have set in the $CONFIG->emailer_smtp_settings array. As for the values in the array are you using the very same you have used with the plugin before on the older Elgg version? Connection class might be 'plain' instead of 'login'. And you might also have to define 'ssl' and 'port' (twice?) depending what the smtp mail server requires. I never tried SMTP myself so I can't give any other first hand advice.

    As for sendmail it shouldn't be necessary to make any settings at all as long as sendmail it correctly set up on your server. If the test works as explained in the docs but no email notifications are sent on site I wonder if you use an email address as site email that's not matching your domain. In this case sendmail might block it (as anti-spam measure). There's also the question if the receiver of the email notification has enabled emails as allowed notification method in his notification settings. In case of verification emails the question is if the email goes out but gets blocked somewhere on the way to the receiver or ends in the spam folder of the receiver.

  • Well, I managed to get sendmail to work. I probably had messed up some comment line.

    But out of curiosity, I tried every SMTP setting I could and didn't get it to work. 'plain' and 'login'; ssl and not ssl; different ports etc.

    also tried different combinations of uncommenting/changing the $CONFIG->emailer_transport = 'smtp';
    and $CONFIG->emailer_sendmail_settings = '';

    Anyways, sendmail is working now. Thank you!

  • So now again Elgg doesn't send any emails. I've tried to send several validation emails and notifications into many different addresses and different domains. None come through or go into Spam-boxes.

    I'm using Sendmail because SMTP wouldn't work at all.

    The email test http://learn.elgg.org/en/stable/appendix/faqs.html?highlight=email#missing-email
    is again working just fine.

    In the meanwhile I've upgraded Elgg 4.1 into Elgg 4.1.1. Might that have caused problems?