cannot read an undeclared column “smtp_port”

iAssess.Digital
Member | 2
+
0
-

I am trying to get the Login page of my application but after putting username and password, error Cannot read an undeclared column ‘smtp_port’ is being displayed. not able to figure out the reason behind this error. Need urgent help!
Thank you in advance :)

This is code segment of Presenter class
UserPresenter.php

$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’]);
 }

Rick Strafy
Nette Blogger | 81
+
0
-

At which line are you getting the error? Possible scenario is that $mailSetting->smtp_server is null and isset fails and then ini_get(‘smtp_port’) throws error. But the error sounds more like you don't have smtp_port in your table if $mailSetting is some active row.

Last edited by Rick Strafy (2022-11-08 19:42)

iAssess.Digital
Member | 2
+
0
-

Rick Strafy wrote:

At which line are you getting the error? Possible scenario is that $mailSetting->smtp_server is null and isset fails and then ini_get(‘smtp_port’) throws error. But the error sounds more like you don't have smtp_port in your table if $mailSetting is some active row.

i am getting error at line 3 of UserPresenter i.e. ‘port’ ⇒ $mailSetting->smtp_port
i do have smtp_port in table but it is not able to read it

Last edited by iAssess.Digital (2022-11-08 20:45)