Skip to content

Commit

Permalink
Added make_lf_crlf() to remove bare line feeds.
Browse files Browse the repository at this point in the history
 * Added g_strip_bare_lf to toggle use of make_lf_crlf()


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@927 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed May 8, 2002
1 parent 0947703 commit 674b474
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
19 changes: 18 additions & 1 deletion core_email_API.php
Expand Up @@ -489,7 +489,7 @@ function email_send( $p_recipient, $p_subject, $p_message, $p_header="" ) {
}

$mail->Subject = $t_subject;
$mail->Body = "\n".$t_message;
$mail->Body = make_lf_crlf( "\n".$t_message );

if( !$mail->Send() ) {
PRINT "PROBLEMS SENDING MAIL TO: $t_recipient<br />";
Expand All @@ -513,6 +513,11 @@ function email_send( $p_recipient, $p_subject, $p_message, $p_header="" ) {
# $t_headers .= "Content-Type: text/html; charset=iso-8859-1\n";

$t_headers .= $p_header;

$t_recipient = make_lf_crlf( $t_recipient );
$t_subject = make_lf_crlf( $t_subject );
$t_message = make_lf_crlf( $t_message );
$t_headers = make_lf_crlf( $t_headers );
$result = mail( $t_recipient, $t_subject, $t_message, $t_headers );
if ( TRUE != $result ) {
PRINT "PROBLEMS SENDING MAIL TO: $t_recipient<p>";
Expand Down Expand Up @@ -553,4 +558,16 @@ function email_build_subject( $p_bug_id ) {
return "[".$p_project_name." ".$p_bug_id."]: ".$p_subject;
}
# --------------------
# clean up LF to CRLF
function make_lf_crlf( $p_string ) {
global $g_strip_bare_lf;

if ( ON == $g_strip_bare_lf ) {
$p_string = str_replace( "\n", "\r\n", $p_string );
return str_replace( "\r\r\n", "\r\n", $p_string );
} else {
return $p_string;
}
}
# --------------------
?>
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -68,6 +68,7 @@ Mantis
* Added jump to bug form.
* Added core_proj_user_API.php.
* Added make_lf_crlf() to remove bare line feeds.
* Added g_strip_bare_lf to toggle use of make_lf_crlf().
* Added priority reporting on the report form for developers.
* Removed access_min and access threshold concepts from the user and project management.
* Removed extra "echo" in news archive page.
Expand Down
11 changes: 11 additions & 0 deletions doc/configuration.html
Expand Up @@ -343,6 +343,17 @@ <h2>Content</h2>

</td>
</tr>
<tr>
<td bgcolor="#ddddff">
$g_strip_bare_lf
</td>
<td bgcolor="#ffffff">
Some Mail transfer agents (MTAs) don't like bare linefeeds... or they take good input and create bare linefeeds.
If problems occur when sending mail through your server try turning this OFF
<p>
More details here: <a href="http://pobox.com/~djb/docs/smtplf.html">http://pobox.com/~djb/docs/smtplf.html</a>
</td>
</tr>
<tr>
<td bgcolor="#ddddff">
$g_use_phpMailer
Expand Down

0 comments on commit 674b474

Please sign in to comment.