Advertisement
Unable to get the mail settings to reach breva Topic is solved
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Mar 23, 2025 7:11 pm
Unable to get the mail settings to reach breva
Hi all
I have tried to get the Jommla to connect to breva. The mailer=SMTP, smtphost=smtp-relay.brevo.com, SMTP Port=587, SMTP Security=SSL/TLS, SMTP Username=thenameThatBreveGaveMe@@smtp-brevo.com, SMTP Password=ThePasswordGeneratedByBreva. each time i try tosen a test mail it gives "Error
SMTP Error: Could not connect to SMTP host. Failed to connect to server". i know that the breva account works and that my Ubumtu server can reach breva because i did a telnet to the address they supplied and i wrote a php script outside of joomla that sent a test email that was then sent to my email address. I could find no error in the apache error log or php log so it looks like the test email is not making it out of joomla
I have tried to get the Jommla to connect to breva. The mailer=SMTP, smtphost=smtp-relay.brevo.com, SMTP Port=587, SMTP Security=SSL/TLS, SMTP Username=thenameThatBreveGaveMe@@smtp-brevo.com, SMTP Password=ThePasswordGeneratedByBreva. each time i try tosen a test mail it gives "Error
SMTP Error: Could not connect to SMTP host. Failed to connect to server". i know that the breva account works and that my Ubumtu server can reach breva because i did a telnet to the address they supplied and i wrote a php script outside of joomla that sent a test email that was then sent to my email address. I could find no error in the apache error log or php log so it looks like the test email is not making it out of joomla
Last edited by toivo on Sun Apr 06, 2025 9:48 am, edited 1 time in total.
Reason: mod note: moved from 5.x Installation
Reason: mod note: moved from 5.x Installation
Advertisement
- Webdongle
- Joomla! Master
- Posts: 45098
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Unable to get the mail settings to reach breva
Have you authenticated your Domain with them? https://help.brevo.com/hc/en-us/article ... ARC-record
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- toivo
- Joomla! Master
- Posts: 18139
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Unable to get the mail settings to reach breva
Follow the instructions in this Joomla document and post the debug log entries into your reply for advice:
How to debug SMTP mail in Joomla 4
How to debug SMTP mail in Joomla 4
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Mar 23, 2025 7:11 pm
Re: Unable to get the mail settings to reach breva
#
#<?php die('Forbidden.'); ?>
#Date: 2025-04-06 07:36:38 UTC
#Software: Joomla! 5.2.5 Stable [ Uthabiti ] 11-March-2025 16:00 GMT
#Fields: datetime priority clientip category message
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection: opening to ssl://smtp-relay.brevo.com:587, timeout=300, options=array()
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A00010B:SSL routines::wrong version number [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp-relay.brevo.com:587 (Unknown error) [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP ERROR: Failed to connect to server: (0)
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP Error: Could not connect to SMTP host. Failed to connect to server
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection: opening to ssl://smtp-relay.brevo.com:587, timeout=300, options=array()
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A00010B:SSL routines::wrong version number [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp-relay.brevo.com:587 (Unknown error) [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP ERROR: Failed to connect to server: (0)
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP Error: Could not connect to SMTP host. Failed to connect to server
#<?php die('Forbidden.'); ?>
#Date: 2025-04-06 07:36:38 UTC
#Software: Joomla! 5.2.5 Stable [ Uthabiti ] 11-March-2025 16:00 GMT
#Fields: datetime priority clientip category message
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection: opening to ssl://smtp-relay.brevo.com:587, timeout=300, options=array()
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A00010B:SSL routines::wrong version number [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp-relay.brevo.com:587 (Unknown error) [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP ERROR: Failed to connect to server: (0)
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP Error: Could not connect to SMTP host. Failed to connect to server
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection: opening to ssl://smtp-relay.brevo.com:587, timeout=300, options=array()
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A00010B:SSL routines::wrong version number [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp-relay.brevo.com:587 (Unknown error) [[ROOT]/libraries/vendor/phpmailer/phpmailer/src/SMTP.php line 408]
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP ERROR: Failed to connect to server: (0)
2025-04-06T07:36:38+00:00 ERROR 192.168.100.9 mail Error in Mail API: SMTP Error: Could not connect to SMTP host. Failed to connect to server
-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Mar 23, 2025 7:11 pm
Re: Unable to get the mail settings to reach breva
i wrote a test email web page in php outside of joomla in public_html/something/email.php (maybe not the actual dir) with the same settings and that sent the a test email.
- toivo
- Joomla! Master
- Posts: 18139
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Unable to get the mail settings to reach breva
Did you use the PHP mail() function in the script or some other method?
There is some kind of a mismatch between the SSL/TLS versions supported by the web server and the Brevo SMTP server. Talk to the support teams of both of them to sort out the issue.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Mar 23, 2025 7:11 pm
Re: Unable to get the mail settings to reach breva
the script i used on was <?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php'; // Include Composer's autoloader
// SMTP Settings
$smtp_host = 'smtp-relay.brevo.com';
$smtp_port = 587;
$smtp_user = '[email protected]'; // Your Brevo SMTP Username
$smtp_pass = 'thepasswordsetbybreva';
// Email Details
$from_email = '[email protected]'; // Sender's email
$to_email = '[email protected]'; // Recipient's email
$subject = 'Test Email from PHP Script';
$body = 'This is a test email sent from a PHP script using Brevo SMTP.';
// Create a new PHPMailer instance
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_OFF; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = $smtp_host; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = $smtp_user; //SMTP username
$mail->Password = $smtp_pass; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = $smtp_port; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->setFrom($from_email, 'Sailor Sea of Fate');
$mail->addAddress($to_email, 'Sailor Sea of Fate'); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AltBody = strip_tags($body); //Non-HTML version of the message
$mail->send();
echo 'Email has been sent successfully';
} catch (Exception $e) {
echo "Email could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
this is on an apache webserver Virtual machine on my proxmox host. the webserver vm is behind a nginx reverse proxy and that is behind a pfsence firewall that fwds 80 and 443 to the cloudflare, cloudflare provide dns and http/s proxy to hide my ip. my connection to cloudflare is https using a cloudflare supplied ssl cert (this cert is not a public cert as it just does the connection between the origin webserver and cloudflare and cloudflare handle the connection to the browser).
If it is a SSL problem i guess it is my reverse proxy that is not fwding on properly. I am not sure why it is only joomla that cant connect to breva but php mail can, so probably not pfsense blocking and probably not cloudflare must be something that joomla does differently to php mailer.
When i get some time i will have to find out what is actually passing each point with wireshark.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php'; // Include Composer's autoloader
// SMTP Settings
$smtp_host = 'smtp-relay.brevo.com';
$smtp_port = 587;
$smtp_user = '[email protected]'; // Your Brevo SMTP Username
$smtp_pass = 'thepasswordsetbybreva';
// Email Details
$from_email = '[email protected]'; // Sender's email
$to_email = '[email protected]'; // Recipient's email
$subject = 'Test Email from PHP Script';
$body = 'This is a test email sent from a PHP script using Brevo SMTP.';
// Create a new PHPMailer instance
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_OFF; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = $smtp_host; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = $smtp_user; //SMTP username
$mail->Password = $smtp_pass; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = $smtp_port; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->setFrom($from_email, 'Sailor Sea of Fate');
$mail->addAddress($to_email, 'Sailor Sea of Fate'); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AltBody = strip_tags($body); //Non-HTML version of the message
$mail->send();
echo 'Email has been sent successfully';
} catch (Exception $e) {
echo "Email could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
this is on an apache webserver Virtual machine on my proxmox host. the webserver vm is behind a nginx reverse proxy and that is behind a pfsence firewall that fwds 80 and 443 to the cloudflare, cloudflare provide dns and http/s proxy to hide my ip. my connection to cloudflare is https using a cloudflare supplied ssl cert (this cert is not a public cert as it just does the connection between the origin webserver and cloudflare and cloudflare handle the connection to the browser).
If it is a SSL problem i guess it is my reverse proxy that is not fwding on properly. I am not sure why it is only joomla that cant connect to breva but php mail can, so probably not pfsense blocking and probably not cloudflare must be something that joomla does differently to php mailer.
When i get some time i will have to find out what is actually passing each point with wireshark.
- toivo
- Joomla! Master
- Posts: 18139
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Unable to get the mail settings to reach breva
The script looks impressive. Your plan is good, too.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Mar 23, 2025 7:11 pm
Re: Unable to get the mail settings to reach breva
Don't be too impressed by the mailer script, it was generated by gemmini the google ai, if it had been me doing the writing it would have been very barebones no comments and not much error check and try catch would be no chance.
i did try to fix the joomla mail problem to brevo but in the end i gave up and installed postfix. Postfix worked like a dream installed and working within about 10 minutes and switched joomla over to php mail and worked straight away. i don't know why i didnt do that earlier but now i know. so if anyone else gets hassle with getting joomla to connect to brevo or similar, Postfix is the answer. However thankyou for your time in looking at this for me.
i did try to fix the joomla mail problem to brevo but in the end i gave up and installed postfix. Postfix worked like a dream installed and working within about 10 minutes and switched joomla over to php mail and worked straight away. i don't know why i didnt do that earlier but now i know. so if anyone else gets hassle with getting joomla to connect to brevo or similar, Postfix is the answer. However thankyou for your time in looking at this for me.
- toivo
- Joomla! Master
- Posts: 18139
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Unable to get the mail settings to reach breva
Thank you for the update!
Reminded me how many years ago I used to run Sendmail to forward mail with Joomla and Linux on a desktop box, connected to a dynamic IP address, before getting a remote host.
Reminded me how many years ago I used to run Sendmail to forward mail with Joomla and Linux on a desktop box, connected to a dynamic IP address, before getting a remote host.
Toivo Talikka, Global Moderator
Advertisement