<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14963] CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14963">14963</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-07-14 14:01:30 -0700 (Tue, 14 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix iMIP send failures when organizer CN is missing or contains non-ascii characters. Make sure iMIP message-ids use the configured server host name as the domain portion of the id.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipinboundpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipoutboundpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/outbound.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipsmtpsenderpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/smtpsender.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimiptesttest_outboundpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipinboundpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py (14962 => 14963)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py        2015-07-14 20:58:41 UTC (rev 14962)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/inbound.py        2015-07-14 21:01:30 UTC (rev 14963)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> from twisted.internet import protocol, defer, ssl
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue, succeed
</span><span class="cx"> from twisted.mail import pop3client, imap4
</span><del>-from twisted.mail.smtp import messageid
</del><span class="cx"> 
</span><span class="cx"> from twistedcaldav.config import config
</span><span class="cx"> from twistedcaldav.ical import Property, Component
</span><span class="lines">@@ -349,7 +348,7 @@
</span><span class="cx">             del msg[&quot;To&quot;]
</span><span class="cx">             msg[&quot;To&quot;] = toAddr
</span><span class="cx">             log.warn(&quot;Mail gateway forwarding reply back to organizer&quot;)
</span><del>-            yield smtpSender.sendMessage(fromAddr, toAddr, messageid(), msg.as_string())
</del><ins>+            yield smtpSender.sendMessage(fromAddr, toAddr, SMTPSender.betterMessageID(), msg.as_string())
</ins><span class="cx">             returnValue(self.REPLY_FORWARDED_TO_ORGANIZER)
</span><span class="cx"> 
</span><span class="cx">         # Process the imip attachment; inject to calendar server
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipoutboundpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/outbound.py (14962 => 14963)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/outbound.py        2015-07-14 20:58:41 UTC (rev 14962)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/outbound.py        2015-07-14 21:01:30 UTC (rev 14963)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> from twext.enterprise.queue import WorkItem
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><del>-from twisted.mail.smtp import messageid, rfc822date
</del><ins>+from twisted.mail.smtp import rfc822date
</ins><span class="cx"> from twisted.web.microdom import Text as DOMText, Element as DOMElement
</span><span class="cx"> from twisted.web.microdom import parseString
</span><span class="cx"> from twisted.web.template import XMLString, TEMPLATE_NAMESPACE, Element, renderer, flattenString, tags
</span><span class="lines">@@ -449,6 +449,8 @@
</span><span class="cx">             orgEmail = organizerMailto[7:]
</span><span class="cx"> 
</span><span class="cx">             orgCN = calendar.getOrganizerProperty().parameterValue('CN', None)
</span><ins>+            if orgCN:
+                orgCN = orgCN.decode(&quot;utf-8&quot;)
</ins><span class="cx">             addressWithToken = formattedFrom
</span><span class="cx"> 
</span><span class="cx">         # At the point we've created the token in the db, which we always
</span><span class="lines">@@ -552,7 +554,7 @@
</span><span class="cx">         msg[&quot;Reply-To&quot;] = replyToAddress
</span><span class="cx">         msg[&quot;To&quot;] = toAddress
</span><span class="cx">         msg[&quot;Date&quot;] = rfc822date()
</span><del>-        msgId = messageid()
</del><ins>+        msgId = SMTPSender.betterMessageID()
</ins><span class="cx">         msg[&quot;Message-ID&quot;] = msgId
</span><span class="cx"> 
</span><span class="cx">         msgAlt = MIMEMultipart(&quot;alternative&quot;)
</span><span class="lines">@@ -654,8 +656,9 @@
</span><span class="cx">         # template stuff, and once again, it's just a 'mailto:'.
</span><span class="cx">         # tags.a(href=&quot;mailto:&quot;+email)[cn]
</span><span class="cx">         if orgEmail:
</span><del>-            details['htmlOrganizer'] = tags.a(href=&quot;mailto:%s&quot; % (orgEmail,))(
-                orgCN)
</del><ins>+            if not orgCN:
+                orgCN = orgEmail
+            details['htmlOrganizer'] = tags.a(href=&quot;mailto:%s&quot; % (orgEmail,))(orgCN)
</ins><span class="cx">         else:
</span><span class="cx">             details['htmlOrganizer'] = orgCN
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimipsmtpsenderpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/smtpsender.py (14962 => 14963)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/smtpsender.py        2015-07-14 20:58:41 UTC (rev 14962)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/smtpsender.py        2015-07-14 21:01:30 UTC (rev 14963)
</span><span class="lines">@@ -24,7 +24,8 @@
</span><span class="cx"> from twext.internet.gaiendpoint import GAIEndpoint
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx"> from twisted.internet import defer, ssl, reactor as _reactor
</span><del>-from twisted.mail.smtp import ESMTPSenderFactory
</del><ins>+from twisted.mail.smtp import ESMTPSenderFactory, messageid
+from twistedcaldav.config import config
</ins><span class="cx"> 
</span><span class="cx"> log = Logger()
</span><span class="cx"> 
</span><span class="lines">@@ -74,3 +75,15 @@
</span><span class="cx">         deferred.addCallback(_success, msgId, fromAddr, toAddr)
</span><span class="cx">         deferred.addErrback(_failure, msgId, fromAddr, toAddr)
</span><span class="cx">         return deferred
</span><ins>+
+
+    @staticmethod
+    def betterMessageID():
+        &quot;&quot;&quot;
+        Strip out the domain in the default Twisted Message-ID value and replace with our configured
+        server host name. That will avoid leaking internal app-server host names in a multi-host setup.
+
+        @return: our safe message-id value
+        @rtype: L{str}
+        &quot;&quot;&quot;
+        return &quot;{}@{}&gt;&quot;.format(messageid().split(&quot;@&quot;)[0], config.ServerHostName)
</ins></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoreschedulingimiptesttest_outboundpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py (14962 => 14963)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py        2015-07-14 20:58:41 UTC (rev 14962)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py        2015-07-14 21:01:30 UTC (rev 14963)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with &quot;&lt;&quot; and &quot;&amp;&quot;
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-&quot;&quot;&quot;
</del><ins>+&quot;&quot;&quot;.encode(&quot;utf-8&quot;)
</ins><span class="cx"> 
</span><span class="cx"> inviteTextNoTimezone = u&quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with &quot;&lt;&quot; and &quot;&amp;&quot;
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-&quot;&quot;&quot;
</del><ins>+&quot;&quot;&quot;.encode(&quot;utf-8&quot;)
</ins><span class="cx"> 
</span><span class="cx"> inviteTextWithTimezone = u&quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with &quot;&lt;&quot; and &quot;&amp;&quot;
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-&quot;&quot;&quot;
</del><ins>+&quot;&quot;&quot;.encode(&quot;utf-8&quot;)
</ins><span class="cx"> 
</span><span class="cx"> ORGANIZER = &quot;urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A&quot;
</span><span class="cx"> ATTENDEE = &quot;mailto:attendee@example.com&quot;
</span><span class="lines">@@ -391,63 +391,63 @@
</span><span class="cx"> 
</span><span class="cx">             # Update
</span><span class="cx">             (
</span><del>-                &quot;&quot;&quot;BEGIN:VCALENDAR
</del><ins>+                u&quot;&quot;&quot;BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> METHOD:REQUEST
</span><span class="cx"> BEGIN:VEVENT
</span><span class="cx"> UID:CFDD5E46-4F74-478A-9311-B3FF905449C3
</span><span class="cx"> DTSTART:20100325T154500Z
</span><span class="cx"> DTEND:20100325T164500Z
</span><del>-ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:
</del><ins>+ATTENDEE;CN=Th\xe9 Attendee;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:
</ins><span class="cx">  mailto:attendee@example.com
</span><del>-ATTENDEE;CN=The Organizer;CUTYPE=INDIVIDUAL;EMAIL=organizer@example.com;PAR
</del><ins>+ATTENDEE;CN=Th\xe9 Organizer;CUTYPE=INDIVIDUAL;EMAIL=organizer@example.com;PAR
</ins><span class="cx">  TSTAT=ACCEPTED:urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A
</span><del>-ORGANIZER;CN=The Organizer;EMAIL=organizer@example.com:urn:uuid:C3B38B00-41
</del><ins>+ORGANIZER;CN=Th\xe9 Organizer;EMAIL=organizer@example.com:urn:uuid:C3B38B00-41
</ins><span class="cx">  66-11DD-B22C-A07C87E02F6A
</span><del>-SUMMARY:testing outbound( ) *update*
</del><ins>+SUMMARY:t\xe9sting outbound( ) *update*
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-&quot;&quot;&quot;,
</del><ins>+&quot;&quot;&quot;.encode(&quot;utf-8&quot;),
</ins><span class="cx">                 &quot;CFDD5E46-4F74-478A-9311-B3FF905449C3&quot;,
</span><span class="cx">                 &quot;urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A&quot;,
</span><span class="cx">                 &quot;mailto:attendee@example.com&quot;,
</span><span class="cx">                 &quot;update&quot;,
</span><span class="cx">                 &quot;organizer@example.com&quot;,
</span><del>-                &quot;The Organizer&quot;,
</del><ins>+                u&quot;Th\xe9 Organizer&quot;,
</ins><span class="cx">                 [
</span><del>-                    (u'The Attendee', u'attendee@example.com'),
-                    (u'The Organizer', u'organizer@example.com')
</del><ins>+                    (u'Th\xe9 Attendee', u'attendee@example.com'),
+                    (u'Th\xe9 Organizer', u'organizer@example.com')
</ins><span class="cx">                 ],
</span><del>-                &quot;The Organizer &lt;organizer@example.com&gt;&quot;,
-                &quot;The Organizer &lt;organizer@example.com&gt;&quot;,
</del><ins>+                u&quot;Th\xe9 Organizer &lt;organizer@example.com&gt;&quot;,
+                &quot;=?utf-8?q?Th=C3=A9_Organizer_=3Corganizer=40example=2Ecom=3E?=&quot;,
</ins><span class="cx">                 &quot;attendee@example.com&quot;,
</span><span class="cx">             ),
</span><span class="cx"> 
</span><span class="cx">             # Reply
</span><span class="cx">             (
</span><del>-                &quot;&quot;&quot;BEGIN:VCALENDAR
</del><ins>+                u&quot;&quot;&quot;BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> METHOD:REPLY
</span><span class="cx"> BEGIN:VEVENT
</span><span class="cx"> UID:DFDD5E46-4F74-478A-9311-B3FF905449C4
</span><span class="cx"> DTSTART:20100325T154500Z
</span><span class="cx"> DTEND:20100325T164500Z
</span><del>-ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;EMAIL=attendee@example.com;PARTST
</del><ins>+ATTENDEE;CN=Th\xe9 Attendee;CUTYPE=INDIVIDUAL;EMAIL=attendee@example.com;PARTST
</ins><span class="cx">  AT=ACCEPTED:urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A
</span><del>-ORGANIZER;CN=The Organizer;EMAIL=organizer@example.com:mailto:organizer@exam
</del><ins>+ORGANIZER;CN=Th\xe9 Organizer;EMAIL=organizer@example.com:mailto:organizer@exam
</ins><span class="cx">  ple.com
</span><del>-SUMMARY:testing outbound( ) *reply*
</del><ins>+SUMMARY:t\xe9sting outbound( ) *reply*
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-&quot;&quot;&quot;,
</del><ins>+&quot;&quot;&quot;.encode(&quot;utf-8&quot;),
</ins><span class="cx">                 None,
</span><span class="cx">                 &quot;urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A&quot;,
</span><span class="cx">                 &quot;mailto:organizer@example.com&quot;,
</span><span class="cx">                 &quot;reply&quot;,
</span><span class="cx">                 &quot;organizer@example.com&quot;,
</span><del>-                &quot;The Organizer&quot;,
</del><ins>+                u&quot;Th\xe9 Organizer&quot;,
</ins><span class="cx">                 [
</span><del>-                    (u'The Attendee', u'attendee@example.com'),
</del><ins>+                    (u'Th\xe9 Attendee', u'attendee@example.com'),
</ins><span class="cx">                 ],
</span><span class="cx">                 &quot;attendee@example.com&quot;,
</span><span class="cx">                 &quot;attendee@example.com&quot;,
</span><span class="lines">@@ -621,6 +621,59 @@
</span><span class="cx">         self.assertEquals(actualTypes, expectedTypes)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def test_generateEmail_noOrganizerCN(self):
+        &quot;&quot;&quot;
+        L{MailHandler.generateEmail} generates a MIME-formatted email when
+        the organizer property has no CN parameter.
+        &quot;&quot;&quot;
+        calendar = Component.fromString(initialInviteText)
+        _ignore_msgID, msgTxt = self.sender.generateEmail(
+            inviteState='new',
+            calendar=calendar,
+            orgEmail=u&quot;user01@localhost&quot;,
+            orgCN=None,
+            attendees=[(u&quot;Us\xe9r One&quot;, &quot;user01@localhost&quot;),
+                       (u&quot;User 2&quot;, &quot;user02@localhost&quot;)],
+            fromAddress=&quot;user01@localhost&quot;,
+            replyToAddress=&quot;imip-system@localhost&quot;,
+            toAddress=&quot;user03@localhost&quot;,
+        )
+        message = email.message_from_string(msgTxt)
+        self.assertTrue(message is not None)
+
+
+    def test_generateEmail_noAttendeeCN(self):
+        &quot;&quot;&quot;
+        L{MailHandler.generateEmail} generates a MIME-formatted email when
+        the attendee property has no CN parameter.
+        &quot;&quot;&quot;
+        calendar = Component.fromString(initialInviteText)
+        _ignore_msgID, msgTxt = self.sender.generateEmail(
+            inviteState='new',
+            calendar=calendar,
+            orgEmail=u&quot;user01@localhost&quot;,
+            orgCN=u&quot;User Z\xe9ro One&quot;,
+            attendees=[(None, &quot;user01@localhost&quot;),
+                       (None, &quot;user02@localhost&quot;)],
+            fromAddress=&quot;user01@localhost&quot;,
+            replyToAddress=&quot;imip-system@localhost&quot;,
+            toAddress=&quot;user03@localhost&quot;,
+        )
+        message = email.message_from_string(msgTxt)
+        self.assertTrue(message is not None)
+
+
+    def test_messageID(self):
+        &quot;&quot;&quot;
+        L{SMTPSender.betterMessageID} generates a Message-ID domain matching
+        the L{config.ServerHostName} value.
+        &quot;&quot;&quot;
+        self.patch(config, &quot;ServerHostName&quot;, &quot;calendar.example.com&quot;)
+        msgID, message = self.generateSampleEmail()
+        self.assertEquals(message['Message-ID'], msgID)
+        self.assertEqual(msgID[:-1].split(&quot;@&quot;)[1], config.ServerHostName)
+
+
</ins><span class="cx">     def test_alwaysIncludeTimezones(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         L{MailHandler.generateEmail} generates a MIME-formatted email with a
</span></span></pre>
</div>
</div>

</body>
</html>