View Issue Details

IDProjectCategoryView StatusLast Update
0001316SOGoBackend Calendarpublic2011-12-12 11:36
Reportermak Assigned Tofrancis  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.3.7 
Target Version1.3.11Fixed in Version1.3.11 
Summary0001316: Missing To and From header encoding in sogo-ealarm-notify mails
Description

If realnames (cn or displayname) contain non-7-bit-ascii characters they are used unencoded in To- and From-headers of mails generated by sogo-ealarms-notify.
This might lead to spam-points.

Subject header is encoded correctly.

Additional Information

Example headers:
...
Subject: =?utf-8?q?=C3=9Cmlauttest?=
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
User-Agent: SOGo Alarms Notifier/1.0
To: Jürgen Ümlaut <Juergen.Uemlaut@example.com>
From: Jürgen Ümlaut <Juergen.Uemlaut@example.com>
...

TagsNo tags attached.

Activities

mak

mak

2011-06-03 17:45

reporter   ~0002533

Despite my poor C and no Objective C knowledge I think I found a solution.
Tested with two 1.3.7a installations.
Please have a look at the attached patch.

2011-06-03 17:46

 

0001316_sogo-ealarms-notifier.patch (1,267 bytes)   
--- SOGo/Tools/SOGoEAlarmsNotifier.m.orig	2011-06-02 17:53:46.294971928 +0200
+++ SOGo/Tools/SOGoEAlarmsNotifier.m	2011-06-03 22:29:02.674968888 +0200
@@ -91,7 +91,7 @@
   [headers setObject: @"quoted-printable" forKey: @"Content-Transfer-Encoding"];
 
   identity = [owner primaryIdentity];
-  fullName = [identity objectForKey: @"fullName"];
+  fullName = [[identity objectForKey: @"fullName"] asQPSubjectString: @"utf-8"];
   if ([fullName length])
     email = [NSString stringWithFormat: @"%@ <%@>", fullName,
                 [identity objectForKey: @"email"]];
@@ -109,9 +109,15 @@
                       withMailer: (SOGoMailer *) mailer
 {
   NGMimeMessage *message;
-  NSString *to;
+  NSString *to, *headerTo, *attendeeName;
 
-  [headers setObject: [attendee mailAddress] forKey: @"To"];
+  attendeeName = [[attendee cnWithoutQuotes] asQPSubjectString: @"utf-8"];
+  if ([attendeeName length])
+    headerTo = [NSString stringWithFormat: @"%@ <%@>", attendeeName,
+                [attendee rfc822Email]];
+  else
+    headerTo = [attendee rfc822Email];
+  [headers setObject: headerTo forKey: @"To"];
   [headers setObject: [self _messageID] forKey: @"Message-Id"];
   message = [NGMimeMessage messageWithHeader: headers];
   [message setBody: content];
francis

francis

2011-12-12 11:36

administrator   ~0003148

Committed in revision 9460deffbf939afae0a607ea07e015924c93fd01. Thanks!

Issue History

Date Modified Username Field Change
2011-05-23 11:09 mak New Issue
2011-06-03 17:45 mak Note Added: 0002533
2011-06-03 17:46 mak File Added: 0001316_sogo-ealarms-notifier.patch
2011-11-24 14:47 ludovic Target Version => 1.3.11
2011-12-12 11:36 francis Note Added: 0003148
2011-12-12 11:36 francis Status new => resolved
2011-12-12 11:36 francis Fixed in Version => 1.3.11
2011-12-12 11:36 francis Resolution open => fixed
2011-12-12 11:36 francis Assigned To => francis