Page 1 of 1

SMTP options

Posted: Tue Feb 15, 2022 10:45 am
by kamaldua
I am trying to make email work using sendgrid api but it does not work. FormaLMS shows email sent but nothing happens.
What are these options used for in config file:
$cfg['use_smtp_database'] = 'on';
$cfg['use_smtp'] = 'on';
$cfg['smtp_debug']
how setting $cfg['smtp_debug'] to say 3 can help debug? what does $cfg['use_smtp_database'] do?

Re: SMTP options

Posted: Tue Feb 15, 2022 11:37 am
by alfa24
When $cfg['use_smtp_database'] is 'on', credentials and connection parameters are stored in the DB, and you can set them in the backend (configuration).

Re: SMTP options

Posted: Wed Feb 16, 2022 9:39 am
by kamaldua
There is problem with lib.mailer.php
SMTP values are not getting passed in SmtpAdm::getInstance()->

If I hardcode SMTP values in lib.mailer.php it works fine.
Where can we report bugs?

Re: SMTP options

Posted: Wed Feb 16, 2022 9:50 am
by alfa24
There is no public bug tracker.
You can post here your solution (if you have one).

Re: SMTP options

Posted: Wed Feb 16, 2022 1:28 pm
by kamaldua
following is solution:
I am not sure why original code is not working though looks ok:
File: /appCore/models/SmtpAdm.php
Original ( does not work):

Code: Select all

    public static function isEnabledDatabase()
    {
        $smtpConfigIsEnabled = Get::cfg('use_smtp_database');

        switch ($smtpConfigIsEnabled) {
            case 'on':
            case 'true':
            case true:
                return true;
                break;
            default:
                return false;
                break;

        }
    }
This works:

Code: Select all

    public static function isEnabledDatabase()
    {
        $smtpConfigIsEnabled = Get::cfg('use_smtp_database');

        switch ($smtpConfigIsEnabled) {
            case 'off':
		return false;
                break;
			case 'on':
            case 'true':
            case true:
                return true;
                break;
            default:
                return false;
                break;

        }
    }

Re: SMTP options

Posted: Wed Feb 16, 2022 1:52 pm
by alfa24
what die(var_dump($smtpConfigIsEnabled)) would return in the non working case?