View Issue Details

IDProjectCategoryView StatusLast Update
0020684mantisbtemailpublic2016-06-12 00:42
Reporteratrol Assigned Tovboctor  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-rc.1 
Target Version1.3.0-rc.2Fixed in Version1.3.0-rc.2 
Summary0020684: Possible regression caused by changed $g_debug_email handling
Description

Commit 4235a08618da1d66b44337867b72f4fdea633dc0 changed logic

from
/**

  • Used for debugging e-mail notifications.
  • When it is OFF, the emails are sent normally.
  • If set to an e-mail address, all messages are sent to it, with the
  • original recipients (To, Cc, Bcc) included in the message body.
  • @global int $g_debug_email
    */
    $g_debug_email = OFF;

to
/**

  • 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 = '';

The administrator documentation has not been updated to reflect this change.

I think that having just a string instead of OFF|email-address is the better approach, but it introduces a regression after upgrading if
someone has set $g_debug_email = OFF; in config_inc.php (the system will try to send email to address 0)
Maybe this is one of some reasons why there are some users telling that e-mail does no longer work after upgrading to 1.3.x.

TagsNo tags attached.

Relationships

related to 0020679 closeddregad Enhance the logging to show email addresses being sent to 

Activities

atrol

atrol

2016-03-10 03:53

developer   ~0052733

Reminder sent to: dregad, vboctor

What do you think?
1) revert the change or
2) update documentation and have a check in check_email_inc.php for $g_debug_email == OFF

The old logic is a bit confusing, e.g. have a look at 0020679 and https://www.mantisbt.org/forums/viewtopic.php?f=3&t=23672#p58948

So I tend to say that option 2) is the better one.

dregad

dregad

2016-03-10 04:31

developer   ~0052735

I like the consistency approach of always using strings introduced by this commit, so I'm also in favor of option 2.

Moving forward...

update the docs

definitely

have a check in check_email_inc.php for $g_debug_email == OFF

OK, but to cover 0020679 we need to cover the "ON" case too. However, that should be transitional.

To allow us to eventually remove the extra code in email_send(), I believe we should also add a step in admin checks, to inform admins they need to update their config.

atrol

atrol

2016-03-10 04:54

developer   ~0052737

OK, but to cover 0020679 we need to cover the "ON" case too
I don't think so, ON did never work, this was just a mistake of the user.

dregad

dregad

2016-03-10 05:38

developer   ~0052738

Currently the code does

if( !empty( $t_debug_email ) ) {

If instead we did

if( !$t_debug_email ) {

it would cover the case of debug_email = '' as well as OFF (and false too)

To cover the user's case in 0020679 (i.e. facilitate troubleshooting), we could also amend the log event message to indicate we're using the debug e-mail.

vboctor

vboctor

2016-03-20 12:26

manager   ~0052808

Let's go with option 2 and get OFF to work. I don't know if this really is worth a check for administrator, so I wouldn't bother with that.

vboctor

vboctor

2016-06-04 19:35

manager   ~0053265

PR: https://github.com/mantisbt/mantisbt/pull/784

dregad

dregad

2016-06-05 19:02

developer   ~0053270

Following up on my note 0020684:0052738, I added a logging message when using debug email, as originally requested in 0020679.

Related Changesets

MantisBT: master 4235a086

2014-01-06 12:55

Paul Richards


Details Diff
1) Always treat debug email address as a string (this makes phpdoc/clients that try to do type checking less confused)

2) Use PHP's own email validation routines (available since php 5.2)
Affected Issues
0020684
mod - admin/check/check_config_inc.php Diff File
mod - config_defaults_inc.php Diff File
mod - core/email_api.php Diff File
mod - login_page.php Diff File

MantisBT: master 8684dfea

2016-06-04 15:31

vboctor


Details Diff
Update documentation of 'debug_email'

Fixes 0020684
Affected Issues
0020684
mod - docbook/Admin_Guide/en-US/config/logging.xml Diff File

MantisBT: master 0bb3cfb1

2016-06-05 14:49

dregad


Details Diff
Enhance logging to show debug email when used

Prior to this, when using an invalid address, user would not see a clear
indication in the log file that the debug email was being used,
resulting in confusion caused by the error message generated by
email_send().

This commit adds a LOG_EMAIL_VERBOSE entry clearly showing when the
debug email address is used.

Fixes 0020679
Affected Issues
0020679, 0020684
mod - core/email_api.php Diff File