Debug Sending E-Mail

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mister_lister
Posts: 6
Joined: 30 May 2015, 06:47

Debug Sending E-Mail

Post by mister_lister »

Hello togehter.

I have Mantis 1.2.15 installed and had to change the email settings.
Before Mantis worked fine with

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_MAIL
.
For security reason we have deactivated PHP mail() so I had to switch to

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_SMTP
.
I'm wondering if there is an option to debug the mail handling completely. The reason is, I do not receive an email. It seems no email will be send by Mantis.
For example I try to reset my password (click on lost password).
In the config file I added:

Code: Select all

$g_log_level = LOG_EMAIL | LOG_EMAIL_REIPIENT | LOG_FILTERING | LOG_AJAX | LOG_DATABASE | LOG_LDAP;
$g_log_destination = 'file:logs/mantisbt.log';
In the file I get a line like this:
2015-08-09 15:42 CEST mail Password reset for email = name@domain.tld
But my mailservers logs said, there is no outgoing email.
Because there is no error on the mantis log file I think my email settings are ok.
So, is there a possibility to debug this email handling?
Is there an option to test email sending with Mantis?

Thansk in advance!
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug Sending E-Mail

Post by atrol »

mister_lister wrote:so I had to switch to

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_SMTP
.
Did you just change this single option?
If so, you have to set also all SMTP related settings. ($g_smtp_*)
https://www.mantisbt.org/docs/master-1. ... NFIG.EMAIL
Please use Search before posting and read the Manual
mister_lister
Posts: 6
Joined: 30 May 2015, 06:47

Re: Debug Sending E-Mail

Post by mister_lister »

atrol wrote:
mister_lister wrote:so I had to switch to

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_SMTP
.
Did you just change this single option?
I added a lot of additional settings regarding the SMTP communication.
The setting are:

Code: Select all

# --- Email Configuration ---
$g_enable_email_notification = ON; //enables the email messages
$g_phpMailer_method		= PHPMAILER_METHOD_SMTP;
$g_smtp_host			= 'mail.domain.tld';
$g_smtp_port			= '587';
$g_smtp_connection_mode	= 'ssl';
$g_smtp_username		= 'myusername';
$g_smtp_password		= 'abcd1234';
$g_administrator_email  = 'bugtracker@domain.tld';
$g_webmaster_email      = 'webmaster@domain.tld';
$g_from_name			= 'Its me';
$g_from_email           = 'noreply@domain.tld';
$g_return_path_email    = 'info@domain.tld';
$g_email_receive_own	= OFF;
$g_email_send_using_cronjob = OFF;
As I wrote, because the Mantis log didn't show any error, I think my settings are ok. Or is there something wrong?
Any idea?
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug Sending E-Mail

Post by atrol »

I recommend to upgrade to latest stable version (1.2.19 atm) as we fixed some e-mail related issues since 1.2.15.
e.g. this one https://www.mantisbt.org/bugs/view.php?id=15958 replaces the underlying mailer library by a newer one.
Please use Search before posting and read the Manual
mister_lister
Posts: 6
Joined: 30 May 2015, 06:47

Re: Debug Sending E-Mail

Post by mister_lister »

atrol wrote:I recommend to upgrade to latest stable version (1.2.19 atm) as we fixed some e-mail related issues since 1.2.15.
I already tried to upgrade to 1.2.19 but than I had some other issues like it wasn't possible to edit the status of a ticket. So, I had to downgrade to go ahead with working with Mantis.
It would be perfekt if I can fix this issue with 1.2.15 and to get some help how to debug this mail sending process. Is there any option to do this?
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug Sending E-Mail

Post by atrol »

It takes five minutes to try if the problem is fixed in 1.2.19.
I still recommend this as a first step instead of starting debugging an outdated version 1.2.15 that comes with a lot of known (security) issues.

Did you read this viewtopic.php?f=3&t=15398 ?
Please use Search before posting and read the Manual
mister_lister
Posts: 6
Joined: 30 May 2015, 06:47

Re: Debug Sending E-Mail

Post by mister_lister »

atrol wrote:It takes five minutes to try if the problem is fixed in 1.2.19.
I still recommend this as a first step instead of starting debugging an outdated version 1.2.15 that comes with a lot of known (security) issues.
It is me again.
I did the update to 1.2.19 and had the same error. After rrying, researching, trying, and so on I had the ide to change the port from 587 to 465 - and it works.
Unbelivable, but it seams the email function can not connect over port 587. The mailserver can do it, because I tried it from a regular email client.
Nevertheless, it works now.

But, I still sue 1.2.15 because with 1.2.19 I still have the problem I can not change the status anymore (on view.php) but I can assign to other users.
Is this a bug or a new feature? ;-)
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug Sending E-Mail

Post by atrol »

Thanks for coming back and telling the solution.
Dealing with ssl/tls, SMTP/SMTPS, ports 25/465/587, different servers/clients can be a nightmare.
mister_lister wrote:with 1.2.19 I still have the problem I can not change the status anymore (on view.php)
What does this exactly mean?
Don't you get the button "Change status to:" any longer?
Or do you get an error message when trying to change the status?
Please use Search before posting and read the Manual
Post Reply