SMTP options

Install and configure FormaLMS and DoceboCE
Post Reply
kamaldua
Newbie
Posts: 17
Joined: Mon Jan 17, 2022 5:17 am

SMTP options

Post 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?
alfa24
Senior Boarder
Posts: 2165
Joined: Fri Nov 24, 2017 8:45 am

Re: SMTP options

Post 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).
Per supporto GRATUITO contattatemi in privato qui
kamaldua
Newbie
Posts: 17
Joined: Mon Jan 17, 2022 5:17 am

Re: SMTP options

Post 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?
alfa24
Senior Boarder
Posts: 2165
Joined: Fri Nov 24, 2017 8:45 am

Re: SMTP options

Post by alfa24 »

There is no public bug tracker.
You can post here your solution (if you have one).
Per supporto GRATUITO contattatemi in privato qui
kamaldua
Newbie
Posts: 17
Joined: Mon Jan 17, 2022 5:17 am

Re: SMTP options

Post 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;

        }
    }
alfa24
Senior Boarder
Posts: 2165
Joined: Fri Nov 24, 2017 8:45 am

Re: SMTP options

Post by alfa24 »

what die(var_dump($smtpConfigIsEnabled)) would return in the non working case?
Per supporto GRATUITO contattatemi in privato qui
BiscottiZA
Newbie
Posts: 6
Joined: Wed Jul 28, 2021 7:00 am

Re: SMTP options

Post by BiscottiZA »

kamaldua wrote: Wed Feb 16, 2022 1:28 pm 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;

        }
    }
This Fixed my problem. Thank you!
User avatar
alberto
FormaLms Guru
Posts: 1153
Joined: Fri Mar 02, 2012 9:18 am
Contact:

Re: SMTP options

Post by alberto »

kamaldua wrote: Wed Feb 16, 2022 1:28 pm following is solution:
I am not sure why original code is not working though looks ok:
File: /appCore/models/SmtpAdm.php
Hello kamaldua,
please consider sending your fix to the official repository, so the Forma Devs will be able to evaluate and add it to the official release
https://github.com/formalms/

Thankyou
Post Reply