I have an email client (thunderbird), I can connect to the mailserver, read and send emails - no problem.
Using Roundcube I can READ emails (IMAPS) but I cannot send emails.
PHP: 8.2
sendmail: 8.16.1-11.el9
saslauth: 2.1.27-21.el9
OS: Almalinux 9.4
This is a MULTI IP ADDRESS host, so I cannot bind the ssl (465) port to localhost, it needs to be IP address based.
From the commandline I can telnet into the IPADDRESS, no problem: telnet 139.99.189.91 465
[~] #>telnet 139.99.189.91 465
Trying 139.99.189.91...
Connected to 139.99.189.91.
Escape character is '^]'.
Using PHPMailer I can send an email using the SAME mailserver using the USER running the server.
$mail = new PHPMailer(true);
try
{
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->Host = '139.99.189.91';
$mail->SMTPAuth = true;
$mail->Username = 'XXXXXXXXXXXXXXXX';
$mail->Password = 'YYYYYYYYYYYYYYYY';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
// because I am using IP and NOT hostname
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
ERRORMESSAGE (no matter the setting)
[13-Aug-2024 17:34:57 +1000]: PHP Error: Failed to connect socket: (POST /votWebMail/?_task=mail&_unlock=loading1723534497509&_framed=1&_action=send)
[13-Aug-2024 17:34:57 +1000]: SMTP Error: Connection failed: (Code: -1) in /PATH/program/lib/Roundcube/rcube.php on line 1794 (POST /votWebMail/?_task=mail&_unlock=loading1723534497509&_framed=1&_action=send)
My config (well the current one, I tried many).
$config['smtp_server'] = 'ssl://139.99.189.91';
$config['smtp_port'] = 465;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = null;
$config['smtp_auth_cid'] = null;
$config['smtp_auth_pw'] = null;
DOnt know what's wrong.
Help please!
Its the same as this
Quote// because I am using IP and NOT hostname
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
Have a look at this FAQ (https://github.com/roundcube/roundcubemail/wiki/FAQ#problems-connecting-imapsmtp-server-via-ssltls). Just like in your PHPMailer example you need to use the `smtp_conn_options` Roundcube config setting to disable the certificate verification.
Also with the release of 1.6 the smtp_host and smtp_port config options were retired and replaced with smtp_host. 1.6 release notes (https://github.com/roundcube/roundcubemail/releases/tag/1.6.0)
I am really sorry, I forgot to append this, I already have this in the config file:
$config['smtp_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
),
);
I also have this now:
$config['smtp_host'] = 'ssl://139.99.189.91:465';
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = null;
$config['smtp_auth_cid'] = null;
$config['smtp_auth_pw'] = null;
The error message is now
[14-Aug-2024 09:29:28 +1000]: <nm8r1njo> PHP Error: Failed to connect socket: (POST /votWebMail/?_task=mail&_unlock=loading1723591767596&_framed=1&_action=send)
[14-Aug-2024 09:29:28 +1000]: <nm8r1njo> SMTP Error: Connection failed: (Code: -1) in PATH/program/lib/Roundcube/rcube.php on line 1794 (POST /votWebMail/?_task=mail&_unlock=loading1723591767596&_framed=1&_action=send)