Skip to content

Commit

Permalink
In some cases the emails were not sent. After investigation the probl…
Browse files Browse the repository at this point in the history
…em was

found to be in the case where use_bcc = ON and to_email was sent to ''.  This is
because the recipient was found to be empty and hence the email was not sent.
There was no checking for the headers to check the bcc.  I added a quick fix
which can be improved later.

M .cvsignore: Added phpmailer files to the cvs ignore list.

M core/email_api.php
  (email_bug_info): Changed the checking of the headers / to_email being empty
  to use is_blank().
  (email_send):
  - Only activate shortcut to exit email_send() if recipient (to) is
  empty and bcc is OFF.  For now, we assume that if bcc is ON, it will contain
  some recipients, this will need to be changed later by separating headers from
  bcc.
  - Adjust the formatting of the email debug feature where extra commas were
  added at the end of the to / bcc list.
  - Used is_blank() to test the $p_recipients.
  - Changed include_once() for phpmailer to require_once().


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1780 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jan 29, 2003
1 parent 8c4bb56 commit 05441f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .cvsignore
Expand Up @@ -2,4 +2,6 @@ custom_config_inc.php
custom_constant_inc.php
custom_strings_inc.php
config_inc.php
.#*
core/class.phpmailer.php
core/class.smtp.php
.#*
12 changes: 7 additions & 5 deletions core/email_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: email_api.php,v 1.39 2003-01-25 18:21:08 jlatour Exp $
# $Id: email_api.php,v 1.40 2003-01-29 00:12:10 vboctor Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -619,7 +619,7 @@ function email_bug_info( $p_bug_id, $p_message, $p_headers='' ) {
## win-bcc-bug
if ( OFF == $g_use_bcc ) {
## list of receivers
$to = $g_to_email.(($p_headers && $g_to_email) ? ', ' : '').$p_headers;
$to = $g_to_email.( ( is_blank( $p_headers ) || is_blank( $g_to_email ) ) ? '' : ', ').$p_headers;
# echo '<br />email_bug_info::Sending email to :'.$to;
$res1 = email_send( $to, $p_subject, $t_message, '', $t_category );
} else {
Expand All @@ -645,7 +645,7 @@ function email_send( $p_recipient, $p_subject, $p_message, $p_header='', $p_cate
$t_message = trim( $p_message );

# short-circuit if no recipient is defined
if (!$p_recipient) {
if ( is_blank( $p_recipient ) && ( OFF == config_get('use_bcc') ) ) {
return;
}

Expand Down Expand Up @@ -691,7 +691,8 @@ function email_send( $p_recipient, $p_subject, $p_message, $p_header='', $p_cate
if ( OFF === $t_debug_email ) {
$mail->AddAddress( $t_recipient, '' );
} else {
$t_debug_to .= $t_recipient . ', ';
$t_debug_to .= !is_blank( $t_debug_to ) ? ', ' : '';
$t_debug_to .= $t_recipient;
}
}
}
Expand All @@ -704,7 +705,8 @@ function email_send( $p_recipient, $p_subject, $p_message, $p_header='', $p_cate
if ( OFF === $t_debug_email ) {
$mail->AddBCC( $t_bcc, '' );
} else {
$t_debug_bcc .= $t_bcc . ', ';
$t_debug_bcc .= !is_blank( $t_debug_bcc ) ? ', ' : '';
$t_debug_bcc .= $t_bcc;
}
}
}
Expand Down

0 comments on commit 05441f2

Please sign in to comment.