SiT! Bugs - SiT!
View Issue Details
0001653SiT!outbound emailpublic2011-08-02 13:582011-08-21 11:17
dipohl 
Tomse 
normalminoralways
resolvedfixed 
LinuxLinux2.6+later
3.63p1 
3.90beta1Current GIT 
0001653: Broken File-Attachments
When sending mail thru SiT!-Portal with attaching a file (tested with pdf and doc), the outgoing mail shows an attachment "part.001", that cannot successfully be opened with appropriate client applications (PDF-Reader, MS-Word). The client applications report "broken format" of the file.

I suppose this is an issue of failing mime encoding/decoding.

The file attached to the ticket in SiT!-Portal is ok and viewable.
Send mail with file attached from within SiT!-Portal.
Webserver:
Name : apache2 Relocations: (not relocatable)
Version : 2.2.3 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 16.29.2 Build Date: Wed Apr 14 13:29:17 2010

PHP-Modul:
Name : apache2-mod_php5 Relocations: (not relocatable)
Version : 5.2.14 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 0.14.1 Build Date: Thu Mar 10 15:52:07 2011
No tags attached.
log sit-debug.log (1,292) 2011-08-14 11:13
http://bugs.sitracker.org/file_download.php?file_id=194&type=bug
txt sourcecode-mail.txt (1,443) 2011-08-14 11:13
http://bugs.sitracker.org/file_download.php?file_id=195&type=bug
Issue History
2011-08-02 13:58dipohlNew Issue
2011-08-06 11:21ivanNote Added: 0004139
2011-08-13 19:35paulhNote Added: 0004222
2011-08-13 19:35paulhStatusnew => feedback
2011-08-14 11:06dipohlNote Added: 0004225
2011-08-14 11:06dipohlStatusfeedback => new
2011-08-14 11:13dipohlFile Added: sit-debug.log
2011-08-14 11:13dipohlFile Added: sourcecode-mail.txt
2011-08-14 11:24paulhNote Added: 0004226
2011-08-14 11:42dipohlNote Added: 0004227
2011-08-14 11:55TomseAssigned To => Tomse
2011-08-14 11:55TomseStatusnew => assigned
2011-08-14 11:57TomseNote Added: 0004228
2011-08-14 11:57TomseStatusassigned => resolved
2011-08-14 11:57TomseFixed in Version => Current SVN
2011-08-14 11:57TomseResolutionopen => fixed
2011-08-14 11:58TomseStatusresolved => feedback
2011-08-14 11:58TomseResolutionfixed => reopened
2011-08-14 11:58TomseTarget Version => 3.65 LTS
2011-08-14 11:58TomseStatusfeedback => resolved
2011-08-14 11:58TomseResolutionreopened => fixed
2011-08-14 14:07ivanNote Added: 0004229
2011-08-14 14:07ivanStatusresolved => confirmed
2011-08-14 14:52TomseNote Added: 0004230
2011-08-14 14:53TomseTarget Version3.65 LTS => 3.90beta1
2011-08-21 11:17TomseNote Added: 0004248
2011-08-21 11:17TomseStatusconfirmed => resolved
2011-08-21 11:17TomseFixed in VersionCurrent SVN => Current GIT

Notes
(0004139)
ivan   
2011-08-06 11:21   
I've tried to reproduce this but am unable.
(0004222)
paulh   
2011-08-13 19:35   
I've tried to reproduce this as well and unable to, I don;t quite understand what you mean via the SiT portal as you can't mail though the portal I'm assuming you mean through the normal sit interface as an engineer
(0004225)
dipohl   
2011-08-14 11:06   
Hi Paul, thanks for the follow-up!

Your assumption is right, I meant the "engineers sit interface".

Concerning the reported error: It seems that to manifest / appearing the error there is the involvement of both players needed:

1. SiT! inserts CRLF although only "LF" is configured (I will attach a protocol from SiT! debug log)

2. Groupwise MTA then inserts (translation rule?) two Linefeeds, which leads to the recognation errors in Mailclients. (I will attach an example from mails sourcecode)

These are insights or assumptions got in a session with Ivan logged in IRC (http://sitracker.org/irc/logs/%23sit.2011-08-09.log.html [^]) followed by some experiments today.

I will try to test the PHP mime mail function in a simple test (outside of SiT!) to open a ticket for our Groupwise mail admin in the office.

The question left concerning SiT! is: How / which way are the "^M" inserted in the mails body?
(0004226)
paulh   
2011-08-14 11:24   
Thanks Dipohl,

I've had reports before regarding the line endings and GroupWise though never the attachment issue, I'll tweak my lab so it routes via my GroupWise system and see what happens
(0004227)
dipohl   
2011-08-14 11:42   
Bug fixed by following code change in /lib/mime.inc.php

 diff -u mime.inc.php mime.inc.php.mine
--- mime.inc.php 2011-07-17 15:01:26.000000000 +0200
+++ mime.inc.php.mine 2011-08-14 12:39:50.363028802 +0200
@@ -112,7 +112,7 @@
             $this->errstr = "fopen() failed";
             return 0; //failed
         }
- $contenttype .= ";\r\n\tname=".basename($path);
+ $contenttype .= ";".CRLF."\tname=".basename($path);
         $data = fread($fp, filesize($path));
         return $this->attach($data,
                 $description,
(0004228)
Tomse   
2011-08-14 11:57   
fixed in git: b712c48
svn: 7255.
(0004229)
ivan   
2011-08-14 14:07   
The current fix isn't suitable for all users, the line terminator should use the new configuration option introduced in 3.90
(0004230)
Tomse   
2011-08-14 14:52   
a new constant has been made for this in SVN: 7256
(0004248)
Tomse   
2011-08-21 11:17   
fixed in GIT : 6271c72
made it configurable