Debug mail

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
br8kwall
Posts: 35
Joined: 03 Mar 2005, 17:36

Debug mail

Post by br8kwall »

Seeking help debugging mail not sending. I have to run this on Windows with IIS.

- phpMailer happily send mails without error. Repeatedly.
- I transferred all mail settings to mantis
- PHPMAILER_METHOD_MAIL
- The admin Mail Test fails with

Testing Mail - PROBLEMS SENDING MAIL TO: <knownvalidemail>@fluidgrid.xyz. Please check your php/mail server settings.

The Event Log plugin (awesome BTW) shows

2016-03-08 14:13 EST [mail] ERROR: Message could not be sent - Invalid address: 1
2016-03-08 14:13 EST [mail] Sending message #3 queued on 2016-03-08 14:13 EST

So where the heck is this so-called Invalid address and how do I find it? I've scoured the configs. Is there more debugging that I can turn on? I'm in Windows and I can't get PHP nor IIS to emit any logs. I spend most of my time using LAMP

Mantis 1.2.19
Windows IIS 8.5, PHP 5.6, MariaDB 10.1
br8kwall
Posts: 35
Joined: 03 Mar 2005, 17:36

Re: Debug mail

Post by br8kwall »

This is my config. One thing I'm wondering is that I had to create an external mail server for testing and the top level domain .xyz was cheap.

Is Mantis doing some kind of validation that doesn't like this unusual TLD? PHPMAILER sends mail just fine using it.

$g_administrator_email = '<known valid email>';
$g_webmaster_email = '<known valid email>';
$g_from_email = '<known valid email>';
$g_from_name = 'Tracker Admin';
$g_return_path_email = '<known valid email>';
$g_enable_email_notification = ON;
$g_email_receive_own = ON;
$g_phpMailer_method = PHPMAILER_METHOD_MAIL;
$g_smtp_host = '<valid external host>';
$g_smtp_username = '<known valid email>';
$g_smtp_password = '<password>';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 587;
atrol
Site Admin
Posts: 8376
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug mail

Post by atrol »

Try

Code: Select all

$g_validate_email = OFF;
Please use Search before posting and read the Manual
br8kwall
Posts: 35
Joined: 03 Mar 2005, 17:36

Re: Debug mail

Post by br8kwall »

Yes, I tried that earlier without improvement. However, your suggestion caused me to find the real issue.

I just changed this value to OFF after turning it ON to try to debug this.. and it started working.

/**
* Used for debugging e-mail feature, when set to OFF the emails work as normal.
* when set to e-mail address, all e-mails are sent to this address with the
* original To, Cc, Bcc included in the message body.
* @global int $g_debug_email
*/
$g_debug_email = OFF;

So, it was a bone-headed mistake. ON is not a valid email address, which mantis was trying to tell me. But since I couldn't see what value it was complaining about in the event log, and to my eye this config value didn't appear to be wrong, it took me days to spot this.

Thank you very much! Perhaps the config section could be enhanced to help others from making the same mistake? And/or see my feature request to allow mantis logging to emit values such as ON where a valid email address was expected.
atrol
Site Admin
Posts: 8376
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Debug mail

Post by atrol »

Thanks for coming back and telling the solution.
Now all that makes sense.
br8kwall wrote: 2016-03-08 14:13 EST [mail] ERROR: Message could not be sent - Invalid address: 1
ON is a constant with value 1 (defined in core/constant_inc.php)

This is how it might look like in next version 1.3.

Code: Select all

/**
 * This is used for debugging the e-mail features in mantis. By default this is blank.
 * This can be set to a valid email address when diagnosing problems with emails.
 * All e-mails are sent to this address with the original To, Cc, Bcc included in the message body.
 * Note: The email is NOT send to the recipients, only to the debug email address.
 * @global string $g_debug_email
 */
$g_debug_email = '';
I opened also a discussion for it, as the new behavior can also introduce a regression https://www.mantisbt.org/bugs/view.php?id=20684
Please use Search before posting and read the Manual
Post Reply