SMTP setup - mails are not being sent

Keywords: LimeSurvey - Google Cloud Platform - Technical issue - Email configuration (SMTP)
bnsupport ID: 0444131a-ff06-3094-d8e0-3c2fba3f1571
Description:
Hi,
I am completely new to Bitnami and Limesurvey - I am trying to setup the SMTP config for my Limesurvey instance.

I followed the bitnami docs

https://docs.bitnami.com/google/apps/limesurvey/configuration/configure-smtp/

And set the config file up with credentials for my Mailgun account - but no mails are sent when a survey is completed (which I expect since I put in my email address in the notification fields in the Limesurvey UI):

// Email Settings
// These settings determine how LimeSurvey will send emails
$config = array();
$config['siteadminemail'] = 'survey@mydomain.dk'; // The default email address of the site administrator
$config['siteadminbounce'] = 'survey@mydomain.dk'; // The default email address used for error notification of sent messages for the site administrator (Return-Path)
$config['siteadminname'] = 'My name'; // The name of the site administrator

$config['emailmethod']        = 'smtp'; // The following values can be used:
$config['protocol'] = $config['emailmethod'];
// mail      -  use internal PHP Mailer
// sendmail  -  use Sendmail Mailer
// smtp      -  use SMTP relaying

$config['emailsmtphost']      = 'smtp.eu.mailgun.org:587'; // Sets the SMTP host. You can also specify a different port than 25 by using
// this format: [hostname:port] (e.g. 'smtp1.example.com:25').

$config['emailsmtpuser']      = 'postmaster@mg.mydomain.dk'; // SMTP authorisation username - only set this if your server requires authorization - if you set it you HAVE to set a password t$
$config['emailsmtppassword']  = 'mypass'; // SMTP authorisation password - empty password is not allowed
$config['emailsmtpssl']       = 'tls'; // Set this to 'ssl' or 'tls' to use SSL/TLS for SMTP connection

$config['emailsmtpdebug']     = 1; // Settings this to 1 activates SMTP debug mode

$config['maxemails']          = 50; // The maximum number of emails to send in one go (this is to prevent your mail server or script from timeouting when sending mass mail)

$config['emailcharset']       = "utf-8";

return $config; // You can change this to change the charset of outgoing emails to some other encoding  - like 'iso-8859-1'

I also looked at this but to no avail.

https://docs.bitnami.com/google/how-to/troubleshoot-smtp-issues/

I wonder if it is needed to install extra apps to make the mail sending work? Postfix or similar?

Hope somebody can give a hint :slight_smile:
Best regards,
Ben

Hi @ben6,

Thank you for using the Bitnami solution. I just reviewed the information of the email.php file and it seems you need to move that configuration to the config.php file

//  =====  CAUTION - DO NOT EDIT THIS FILE ======
// This file contains the default email settings for LimeSurvey
// Do not edit this file as it may change in future revisions of the software.
//
// Correct procedure to set up LimeSurvey is the following:
// 1.) copy the lines corresponding to the parameter you want to change
//   from this file to the config.php file
// 2.) edit these lines in config.php

https://github.com/LimeSurvey/LimeSurvey/blob/master/application/config/email.php#L17

Can you try to edit the main config.php file with your SMTP settings and check if the application works properly? I’ll notify our documentation team to update our guide about how to configure the SMTP settings in the app.

Happy to help!


Was my answer helpful? Click on :heart:

Hi Jota,
thanks for your reply. Unfortunately this does not seem to help. Can you clarify how the mail-sending works - is it via a sendmail binary, PHPMailer?

I have checked for errors in the syslog but haven’t found any and I am not sure where to look.

I did the following

nano /opt/bitnami/apps/limesurvey/conf/config.php

And inserted my data the following way:

<?php if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|   'connectionString' Hostname, database, port and database type for
|    the connection. Driver example: mysql. Currently supported:
|               mysql, pgsql, mssql, sqlite, oci
|   'username' The username used to connect to the database
|   'password' The password used to connect to the database
|   'tablePrefix' You can add an optional prefix, which will be added
|               to the table name when using the Active Record class
|
*/
$config = [];

$config['siteadminemail'] = 'survey@mydomain.dk'; // The default email address of the site administrator
$config['siteadminbounce'] = 'survey@mydomain.dk'; // The default email address used for error notification of sent messages for the site administrator (Return-Path)
$config['siteadminname'] = 'my name'; // The name of the site administrator

$config['emailmethod']        = 'smtp'; // The following values can be used:
$config['protocol'] = $config['emailmethod'];
// mail      -  use internal PHP Mailer
// sendmail  -  use Sendmail Mailer
// smtp      -  use SMTP relaying

$config['emailsmtphost']      = 'smtp.eu.mailgun.org:587'; // Sets the SMTP host. You can also specify a different port than 25 by using
// this format: [hostname:port] (e.g. 'smtp1.example.com:25').

$config['emailsmtpuser']      = 'postmaster@mg.mydomain.dk'; // SMTP authorisation username - only set this if your server requires authorization - if you set it you HAVE to set a password t$
$config['emailsmtppassword']  = 'mypass'; // SMTP authorisation password - empty password is not allowed
$config['emailsmtpssl']       = 'tls'; // Set this to 'ssl' or 'tls' to use SSL/TLS for SMTP connection

$config['emailsmtpdebug']     = 1; // Settings this to 1 activates SMTP debug mode

$config['debug'] = 0;
$config['debugsql'] =0;

return array(
    'components' => array(
        'db' => array(
            'connectionString' => 'mysql:host=localhost;port=3306;dbname=bitnami_limesurvey;',
            'emulatePrepare' => true,
            'username' => 'myuser',
            'password' => 'mypass',
            'charset' => 'utf8mb4',
            'tablePrefix' => 'lime_',
        ),

        // Uncomment the following lines if you need table-based sessions.
        // Note: Table-based sessions are currently not supported on MSSQL server.
        // 'session' => array (
            // 'class' => 'application.core.web.DbHttpSession',
            // 'connectionID' => 'db',
            // 'sessionTableName' => '{{sessions}}',
        // ),

        'urlManager' => array(
            'urlFormat' => 'path',
            'rules' => array(
                // You can add your own rules here
            ),
            'showScriptName' => true,
        ),

    ),
    // Use the following config variable to set modified optional settings copied from config-defaults.php
    'config'=>$config,
);
/* End of file config.php */
/* Location: ./application/config/config.php */

Hi @ben6,

That depends on the application and how you configure it. I suggest you ask the app’s developers to know more about how the application works and how to troubleshoot it.

https://forums.limesurvey.org/

Do not hesitate to contact us if you have any other questions.

Is there no easy way to get email-notifications to work with the Bitnami setup then? I don’t need anything fancy, just notifications for myself…

Hi @ben6,

You are configuring the application, it doesn’t depend on Bitnami or our setup. I checked the app’s documentation and that’s what I found. If that doesn’t work for you, it’s because there is something wrong in the application or in the way you configure the SMTP in the configuration file. The app’s developers should provide more information about how to configure the SMTP settings in their application and how to troubleshoot it in case you find more issues.

Hi Jota,
OK - diving a bit more into the settings of Limesurvery I found out that there is a configuration form available via the UI.

Configuration > Global settings (/index.php/admin/globalsettings) > Email settings tab

When I enter my SMTP data there email-sending works.

Apparently the data in the config.php file is overwritten by the form data?

Hi @ben6,

Perfect! I’m glad to managed to configure the SMTP settings

Do not know how the application sets the priorities for the different configuration parameters. You can ask in the application’s forum to know more about that.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.