Page 1 of 1

Send Email with SMTP port 25 no SSL or TLS

Posted: 15 Jul 2024, 16:12
by nekke
Hi!
i'm in trouble to looking for why mails are not send by Mantis.

I tried to send email with a simple php file like this:

Code: Select all

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php'; // Adjust based on your installation method

$mail = new PHPMailer(true); // Enable exceptions

// SMTP Configuration
$mail->isSMTP();
$mail->Host = 'smtp.mysmtp.com'; // Your SMTP server
$mail->SMTPAuth = true;
$mail->Username = 'username'; // Your Mailtrap username
$mail->Password = 'password'; // Your Mailtrap password
$mail->SMTPSecure = '';
$mail->Port = 25;

// Sender and recipient settings
$mail->setFrom('from@domain.com', 'From Name');
$mail->addAddress('to@domain.com', 'Recipient Name');

// Sending plain text email
$mail->isHTML(false); // Set email format to plain text
$mail->Subject = 'Your Subject Here';
$mail->Body    = 'This is the plain text message body';

// Send the email
if(!$mail->send()){
    echo 'Message could not be sent. Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}
And it's working...

So in mantis i replicated the configuration... and this are log

Code: Select all

2024-07-15 17:51 CEST MAIL email_api.php:1244 email_bug_status_changed() Issue #5 status changed
2024-07-15 17:51 CEST RECIPIENT email_api.php:302 email_collect_recipients() Issue = #5, add @U2 (reporter)
2024-07-15 17:51 CEST RECIPIENT email_api.php:312 email_collect_recipients() Issue = #5, add @U2 (handler)
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:751 email_generic_to_recipients() Issue = #5, Type = new, Msg = 'email_notification_title_for_status_bug_new', User = @U2, Email = 'to@domain.com'.
2024-07-15 17:51 CEST MAIL_VERBOSE email_queue_api.php:129 email_queue_add() message 63 queued
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:2287 email_shutdown_function() Shutdown function called for /bug_update.php
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1340 email_send_all() Processing e-mail queue (1 messages)
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1351 email_send_all() Sending message 63
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1444 email_send() password
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1445 email_send() username
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1451 email_send() SMTPAutoTLS: false
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1453 email_send() SMTPAuth: true
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1458 email_send() 25
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1491 email_send() smtp.mysmtp.com
2024-07-15 17:51 CEST MAIL_VERBOSE email_api.php:1492 email_send() from@domain.com
2024-07-15 17:51 CEST MAIL_VERBOSE email_queue_api.php:192 email_queue_delete() message 63 deleted from queue
2024-07-15 17:51 CEST MAIL email_api.php:1573 email_send() ERROR: Message could not be sent - SMTP Error: Could not authenticate.

As i said with test code in upper page i can send email without problems... with mantis i still get Could not authenticate..

Any suggestions?
Thx!

Re: Send Email with SMTP port 25 no SSL or TLS

Posted: 15 Jul 2024, 23:01
by nekke
Ok i understand...

in file email_api.php the smtp_connection_mode set SMTPAutoTLS to false if the value in
config_defaults_inc.php is blank

email_api.php line 1444

Code: Select all

if( is_blank( config_get( 'smtp_connection_mode' ) ) ) 
{
	$t_mail->SMTPAutoTLS = false;
}
else
{
	$t_mail->SMTPSecure = config_get( 'smtp_connection_mode' );
}
config_defaults_inc.php line 633-->

Code: Select all

**
 * Allow secure connection to the SMTP server
 * Valid values are '' (no encryption), 'ssl' or 'tls'
 * @global string $g_smtp_connection_mode
 */
$g_smtp_connection_mode = '';
When i changed in email_api.php
$t_mail->SMTPAutoTLS = true;

mail start to be sent

Mail notification not sending

Posted: 12 Nov 2024, 12:21
by phuddar27
Hello,

After 23rd Sep 24, The mail notification are sending to user from mantis, The below error are generating in log file..


2024-11-11 11:48 IST MAIL email_api.php:1409 email_send() ERROR: Message could not be sent - SMTP Error: Could not authenticate.
2024-11-11 11:48 IST MAIL email_api.php:1238 email_send_all() Server not responding for 5 seconds, aborting
2024-11-11 17:55 IST MAIL email_api.php:576 email_send_confirm_hash_url() Password reset for user @U3 sent to XXXXX@XXXXXX.com
2024-11-11 17:55 IST MAIL email_api.php:1409 email_send() ERROR: Message could not be sent - SMTP Error: Could not authenticate.
2024-11-11 17:55 IST MAIL email_api.php:1238 email_send_all() Server not responding for 5 seconds, aborting
2024-11-12 16:04 IST MAIL email_api.php:576 email_send_confirm_hash_url() Password reset for user @U3 sent to XXXXX@XXXXXX.com
2024-11-12 16:05 IST MAIL email_api.php:1409 email_send() ERROR: Message could not be sent - SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting
2024-11-12 16:05 IST MAIL email_api.php:1238 email_send_all() Server not responding for 5 seconds, aborting