Error sending support message in ISPConfig panel
Summary
Error sending support message in ISPConfig panel
Steps to reproduce
- Go to Help > Send message and try send a message.
- An error 500 will occurs in the file /help/support_message_edit.php
- This is the log from /var/log/nginx/error.log:
2023/05/30 23:05:15 [error] 26798#26798: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: fsockopen(): Argument #2 ($port) must be of type int, string given in /usr/local/ispconfig/interface/lib/classes/ispcmail.inc.php:588
Stack trace:
#0 /usr/local/ispconfig/interface/lib/classes/ispcmail.inc.php(588): fsockopen()
#1 /usr/local/ispconfig/interface/lib/classes/ispcmail.inc.php(760): ispcmail->_smtp_login()
#2 /usr/local/ispconfig/interface/lib/classes/functions.inc.php(67): ispcmail->send()
#3 /usr/local/ispconfig/interface/web/help/support_message_edit.php(76): functions->mail()
#4 /usr/local/ispconfig/interface/lib/classes/tform_actions.inc.php(69): page_action->onSubmit()
#5 /usr/local/ispconfig/interface/web/help/support_message_edit.php(127): tform_actions->onLoad()
#6 {main}
thrown in /usr/local/ispconfig/interface/lib/classes/ispcmail.inc.php on line 588" while reading response header from upstream, client: 192.168.0.10, server: _, request: "POST /help/support_message_edit.php HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php8.1-fpm/ispconfig.sock:", host: "192.168.0.110:8080", referrer: "https://192.168.0.110:8080/index.php"
Correct behaviour
It should send the support message.
Environment
Server OS + version: Ubuntu 22.04
ISPConfig version: 3.2.9p1
Proposed fix
Updating the smtp_port
property to int at /usr/local/ispconfig/interface/lib/classes/ispcmail.inc.php:588
solves the issue:
$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'tls://' : '') . $this->smtp_host, (int)$this->smtp_port, $errno, $errstr, 30);
Thank you!