View Issue Details

IDProjectCategoryView StatusLast Update
0021896mantisbtemailpublic2016-11-27 00:45
ReporterLeChuckAssigned Todregad 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.17 
Target Version1.3.4Fixed in Version1.3.4 
Summary0021896: Fix Outlook preview for email notifications by removing empty line at top
Description

Usually the body of a mail send by Mantis starts with one sentence that explains what triggered the mail, e.g. "A NOTE has been added to this issue."

In its default view, Outlook shows the subject of an email and the first line of that email (see screenshot "MantisEmptyLineInMail1.png"). But for some reason Mantis starts mails always with an empty line before the "trigger explanation", so Outlook shows this empty line instead of what triggered the mail (which would be really nice info).

After some investigation I finally found that the empty line is added in function email_send (in email_api.php):

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

Is there any reason why a newline is added to the message as the first character? I checked the GitHub source history because I was curious, but even the earliest version of that file (25.08.2002) already contains this code.

If I change the line to this

  $mail->Body = make_lf_crlf( $t_message );

the empty line is gone and Outlook shows the "message trigger line".

Additional Information

Mantis 1.2.17
PHP 5.6.17
Windows Server 2012 R2

TagsNo tags attached.

Activities

LeChuck

LeChuck

2016-11-10 08:47

reporter  

LeChuck

LeChuck

2016-11-10 08:48

reporter  

dregad

dregad

2016-11-11 07:10

developer   ~0054504

I looked at the history, and indeed can't think of any reason for adding the newline at the beginning of the message body.

The explanation I can think of, is that a newline is required as separator between the message header and the body, but PHPMailer handles that for us automatically... maybe earlier versions of the library didn't ?

Anyway, I think this extra newline can be safely removed.

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

Related Changesets

MantisBT: master-1.3.x 5407ec7d

2016-11-11 06:59:37

dregad

Details Diff
Remove leading newline from email body

This extra blank line prevents email clients such as Outlook from
displaying a preview of MantisBT's notification messages in a list view.

The newline does not serve any known purpose (PHPMailer already adds one
to separate the message header from its body), and testing does not show
any regression when notifications are sent sent without it.

This commit removes the extra '\n'.

Fixes 0021896
mod - core/email_api.php Diff File

Issue History

Date Modified Username Field Change
2016-11-10 08:47 LeChuck New Issue
2016-11-10 08:47 LeChuck File Added: MantisEmptyLineInMail1.png
2016-11-10 08:48 LeChuck File Added: MantisEmptyLineInMail2.png
2016-11-11 07:10 dregad Assigned To => dregad
2016-11-11 07:10 dregad Status new => assigned
2016-11-11 07:10 dregad Product Version => 1.2.17
2016-11-11 07:10 dregad Target Version => 1.3.4
2016-11-11 07:10 dregad Note Added: 0054504
2016-11-12 11:31 dregad Changeset attached => MantisBT master-1.3.x 5407ec7d
2016-11-12 11:31 dregad Status assigned => resolved
2016-11-12 11:31 dregad Resolution open => fixed
2016-11-12 11:31 dregad Fixed in Version => 1.3.4
2016-11-24 04:17 vboctor Summary Notification mails sent by Mantis start with empty line => Fix Outlook preview for email notifications by removing empty line at top
2016-11-27 00:45 vboctor Status resolved => closed