Cannot read an undeclared column 'smtp_port'

62 Views Asked by At

I am trying to get the Login page of my application but after putting username and password, error is being displayed

Cannot read an undeclared column 'smtp_port'

not able to figure out the reason behind this error.

UserPresenter.php

this is the code segment of presenter class

     $this->mailer = new Nette\Mail\SmtpMailer(array(
        'host' => $mailSetting->smtp_server,
        'port' => $mailSetting->smtp_port,
        'username' => $mailSetting->from_mail,
        'password' => $mailSetting->password,
        'secure' => $mailSetting->secure_connection,
    ));

SmtpMailer.php

 public function __construct(array $options = array())
    {
        if (isset($options['host'])) {
            $this->host = $options['host'];
            $this->port = isset($options['port']) ? (int) $options['port'] : NULL;
        } else {
            $this->host = ini_get('SMTP');
            $this->port = (int) ini_get('smtp_port');
        }
        $this->username = isset($options['username']) ? $options['username'] : '';
        $this->password = isset($options['password']) ? $options['password'] : '';
        $this->secure = isset($options['secure']) ? $options['secure'] : '';
        $this->timeout = isset($options['timeout']) ? (int) $options['timeout'] : 20;
        if (!$this->port) {
            $this->port = $this->secure === 'ssl' ? 465 : 25;
        }
        $this->persistent = !empty($options['persistent']);
    }
1

There are 1 best solutions below

0
On

It seems like your ini configuration file did not have the key smtp_port, therefor it can't read or maybe some EOL misplace.

For testing purposes, you can directly put the port and run the code first and if it works it can make sure that issue is with smtp_port ini key.