SMTP settings

Now I am using elgg 4.3.8 
the plugin "User validation by email" is deactivated.
New users require manual validation by an administrator in settings is active
 I made the the neccessary changes in settings.php file  to set the smtp settings as in below
 
...
 
 
 
$CONFIG->emailer_sendmail_settings = 'smtp';
 
/**
 * Configure emailer SMTP settings
 *
 * This setting is only necessary if the above emailer transport is set to 'smtp'.
 */
$CONFIG->emailer_smtp_settings = array(
'name'              => 'localhost.localdomain',
'host'              => 'ni-chrome.guzelhosting.com',
'port'              => 465,
'connection_class'  => 'login',
'connection_config' => [
'username' => 'noreply@ahalim.com',
'password' => '******',
'ssl'      => 'ssl', // OPTIONAL (tls or ssl)
'port'     => '465', // OPTIONAL (Non-SSL default 25, SSL default 465, TLS default 587)
// 'use_complete_quit' => '', // OPTIONAL
],
);
 
 
---
 
but liking a post produces "Laminas\Mail\Transport\Exception\RuntimeException" error."
 
Even register displays the same error "Laminas\Mail\Transport\Exception\RuntimeException"
but when I check the results of the processes everything is ok, the post becomes "liked" but no new  register is displayed in the users.
 
And one more thing sending a message through the site causes blue screen with "Unable to send mail: mail() has been disabled for security reasons"
I couldn't solve the issue.
  • This is the full of blue screen

    Fatal Error.

    Unable to send mail: mail() has been disabled for security reasons

    Log at time 2023-11-12T14:56:34+00:00 may have more data
     
    #0 /.../.../.../../laminas/laminas-mail/src/Transport/Sendmail.php(130): Laminas\Mail\Transport\Sendmail->mailHandler('=?UTF-8?Q?fotoc...', '=?UTF-8?Q?You=2...', 'This is a messa...', 'Date: Sun, 12 N...', 'smtp -f'info@ah...')
    #1 /.../.../.../../elgg/elgg/engine/classes/Elgg/EmailService.php(183): Laminas\Mail\Transport\Sendmail->send(Object(Laminas\Mail\Message))
    #2 /.../.../.../../elgg/elgg/engine/classes/Elgg/EmailService.php(119): Elgg\EmailService->transport(Object(Elgg\Email))
    #3 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/SendEmailHandler.php(48): Elgg\EmailService->send(Object(Elgg\Email))
    #4 [internal function]: Elgg\Notifications\SendEmailHandler->__invoke(Object(Elgg\HooksRegistrationService\Hook))
    #5 /.../.../.../../elgg/elgg/engine/classes/Elgg/HandlersService.php(63): call_user_func(Object(Elgg\Notifications\SendEmailHandler), Object(Elgg\HooksRegistrationService\Hook))
    #6 /.../.../.../../elgg/elgg/engine/classes/Elgg/PluginHooksService.php(69): Elgg\HandlersService->call(Object(Elgg\Notifications\SendEmailHandler), Object(Elgg\HooksRegistrationService\Hook), Array)
    #7 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/NotificationEventHandler.php(288): Elgg\PluginHooksService->trigger('send', 'notification:em...', Array, false)
    #8 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/NotificationEventHandler.php(270): Elgg\Notifications\NotificationEventHandler->deliverNotification(Object(Elgg\Notifications\Notification), 'email')
    #9 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/NotificationEventHandler.php(198): Elgg\Notifications\NotificationEventHandler->sendNotification(45, 'email', Array)
    #10 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/NotificationEventHandler.php(56): Elgg\Notifications\NotificationEventHandler->sendNotifications(Array, Array)
    #11 /.../.../.../../elgg/elgg/engine/classes/Elgg/Notifications/NotificationsService.php(346): Elgg\Notifications\NotificationEventHandler->send()
    #12 /.../.../.../../elgg/elgg/engine/lib/notification.php(224): Elgg\Notifications\NotificationsService->sendInstantNotifications(Object(ElggUser), Array, Array)
    #13 /.../.../.../mod/messages/lib/functions.php(108): notify_user(Array, 39, 'You have a new ...', 'You have a new ...', Array)
    #14 /.../.../.../mod/messages/actions/messages/send.php(37): messages_send('You have a new ...', 'You have a new ...', 45, 39, 0)
    #15 /.../.../.../../elgg/elgg/engine/classes/Elgg/Router.php(274): include('/home/buradan4/...')
    #16 /.../.../.../../elgg/elgg/engine/classes/Elgg/Router.php(209): Elgg\Router->getResponseFromFile('/home/buradan4/...', Object(Elgg\Request))
    #17 /.../.../.../../elgg/elgg/engine/classes/Elgg/Router.php(121): Elgg\Router->prepareResponse(Object(Elgg\Http\Request))
    #18 /.../.../.../../elgg/elgg/engine/classes/Elgg/Router.php(101): Elgg\Router->getResponse(Object(Elgg\Http\Request))
    #19 /.../.../.../../elgg/elgg/engine/classes/Elgg/Application.php(454): Elgg\Router->route(Object(Elgg\Http\Request))
    #20 /.../.../.../../elgg/elgg/engine/classes/Elgg/Application.php(345): Elgg\Application->run()
    #21 /.../.../.../../elgg/elgg/engine/classes/Elgg/Application.php(395): Elgg\Application::route(Object(Elgg\Http\Request))
    #22 /.../.../.../index.php(8): Elgg\Application::index()
    #23 {main}
  • Elgg needs the PHP mail command for sending emails. This command has been disabled on your server in the server's php ini. See for example https://stackoverflow.com/questions/28581977/php-mail-function-has-been-disabled-for-security-reasons. You need to enable the mail command for Elgg to work.

  • iionly,

    First of all thanks for your reply. I asked them to enable it  but unfortunately they rejected and said "If you need the Mail() function, this function is disabled in all shared hosting services for security reasons. To be able to use it in this direction, you can choose VDS or VPS packages where you have root authority and server management."

    "Apart from this, I can use SMTP as an alternative instead of mail(). Our SMTP settings are as follows.

    SMTP Host: ni-chrome.guzelhosting.com
    Port: 465
    User name: Your e-mail address that you created from your panel
    Password: your email password
    Secure connection(SSL): SSL
     
    I applied them  in settings.php file of my elgg as above
     
    ---
    $CONFIG->emailer_sendmail_settings = 'smtp';
     
    /**
     * Configure emailer SMTP settings
     *
     * This setting is only necessary if the above emailer transport is set to 'smtp'.
     */
    $CONFIG->emailer_smtp_settings = array(
    // 'name'              => 'localhost.localdomain',
    'host'              => 'ni-chrome.guzelhosting.com',
    // 'port'              => 465,
    'connection_class'  => 'login',
    'connection_config' => [
    'username' => 'noreply@ahalim.com',
    'password' => '*******',
    'ssl'      => 'ssl', // OPTIONAL (tls or ssl)
    'port'     => '465', // OPTIONAL (Non-SSL default 25, SSL default 465, TLS default 587)
    // 'use_complete_quit' => '', // OPTIONAL
    ],
    );
     
    ---
     
    But still I get the error "Laminas\Mail\Transport\Exception\RuntimeException" whenever I try to like a post. Then, when I refresh the page I see that the post liked despite the error.
     
     
     
  • @Fazil,

    1 - Where are you doing this: on localhost or production?

    2 - Do you have 3rd party plugins activated?