============== Z-Push Zimbra Backend - Release Notes - Release 54 ==============
THESE RELEASE NOTES ARE FOR RELEASE 54 CHANGES
PLEASE READ THESE RELEASE NOTES COMPLETELY BEFORE IMPLEMENTING RELEASE 54
NOTE THAT THE RELEASE NOTES FOR 49-53 ARE ALSO CONTAINED BELOW AND SHOULD
ALSO BE READ FULLY WHEN UPGRADING FROM A RELEASE 48 OR EARLIER.
THIS IS EXPECIALLY CRITICAL IF YOU ARE TURNING ON ANY OF THE NEW FEATURES
AND ARE UPGRADING AN EXISTING INSTALLATION FROM RELEASE 48 OR EARLIER.
NOTE THAT MANY OF THE CHANGES RELATE TO THE Z-PUSH-2 VERSION OF THE BACKEND ONLY
ZIMBRA 6.0.4 AND EARLIER - NOT SUPPORTED WITH z-push-2
These releases of zimbra have a bug in the JSON output of commands that breaks the
json_decode parser. If you wish to use z-push-2 with the zimbra backend you must update
to a newer zimbra release. See zimbra bugzilla for details :-
http://bugzilla.zimbra.com/show_bug.cgi?id=42867
Changes Made To Revision 54:
- Use session context refresh to populate _folders and _usertags during Logon
to minimise the number of SOAP requests for setup
- Change GetMpBodyRecursive to search for the part identified by zimbra as
containing the body text instead of piecing together body/inline text parts
- Change GetMessage to group Soap Request/Response into a single switch block
- Removed forcing parent to '0' for Calendars/Tasks
- Updated mime.php and mimePart.php in line with mail_mime 1.8.5 which contains
a fix for a bug we reported upstream concerning decoding headers
- Fixed messageclass for Meeting Replies/Cancellation
- Fixed timezone object creation issue that broke timezone matching on android
and resulted in DST changes moving recurring appointments
- Added sendasemail directive, and fixed regression in SendMail to force use of
_SendAsEmailOverride when configured by the user (directive or XML)
- Change SendMail to pass through encoded headers
- Fix regression regarding inline image only emails introduced in 53.7.z-push-2
- Added code to allow for not receiving a From: header from the (HTC) device
- Added code to encode From: header - if not encoded in _SendAsNameOverride
- Added basic check for incompatability between z-push and backend versions
- For z-push-2 fix truncation logic for BodyPreference[1] and [2]
- For z-push-2 BatchRequest plain and/or html bodies into a single SOAP Request
- For z-push-2 change to JSON for SOAP response processing - with the exception
of non SmartFolders folder initialization which uses a linear array to process
folders instead of a nested one. The MakeXMLTree function was mangling HTML
contained within XML nodes, and making it difficult to process.
- For z-push-2 remove Provisioning support code
- For z-push-2 remove AlterPing support code - replaced with ChangesSink
- For z-push-2 remove getSettings/setSettings - add Settings
- For z-push-2 report protocol version supported as 14 (ZPush::ASV_14;) even
though SMS sync is not supported - this version is needed for attendee
status updates to be shown on the device
- For z-push-2 rename function ItemOperationsEmptyFolderContent to EmptyFolder
- For z-push-2 fixed SendMail to check for content before setting parameters to
avoid "SyncMail: parameter 'reply_to' contains an invalid email address ''"
- For z-push-2 attachment->filereference has to be bin2hex encoded so that part
numbers for subparts/attachments do not lose their "." separators in the new
"evil" filters in request.php
- For z-push-2 add Utils:: prefix to call to function GetOLUidFromICalUid
- For z-push-2 fix notes handling for AS12+ appointments/tasks - keep original
notes if not updated (or update not sent - WM6.5)
- For z-push-2 add function GetUserInfo and move code from Logon into it to
ensure user profile info is known prior to calling GetUserProfileXML
- For z-push-2 Fixed extract of $id on contact creation to stop looping on
new contact created on the device.
- For z-push-2 refactored GetMessageList into a single switch block
- For z-push-2 added local caching of MessageLists to reduce server load on
initial sync where the same unchanged lists will be queried repeatedly
- For z-push-2 changed debugLog to ZLog::Write and adjusted logging levels for
errors in Logon so that obvious issues are highlighted without debug being on
- For z-push-2 added delay logic to ChangesSink in event of loss of connectivity
to the host
Use Session Context Refresh to populate _folders and _usertags
==============================================================
When issuing the AuthRequest command to logon to the backend it is possible to get
a session context refresh by specifying no session in the request. By using this
session context refresh to populate _folders and _usertags during Logon it minimises
the number of SOAP requests needed during the initial setup
Change GetMpBodyRecursive to look for zimbra highlighted Body part
==================================================================
Change GetMpBodyRecursive to search for the part identified by zimbra as
containing the body text instead of piecing together body/inline text parts. Note
inline text parts (such as disclaimers) still need to be appended
Change GetMessage to group Soap Request/Response into a single switch block
===========================================================================
A change of structure has been made to GetMessage to group Soap Request/Response
into a single switch block instead of one each for Request and Response sections.
This will make maintenance easier going forward
Removed forcing parent to '0' for Calendars/Tasks
=================================================
Historically the parent of Calendar/Task folders has been forced to Root ('0')
As zimbra 8 is due to allow nested calendars, this forcing of the parent to '0'
for Calendars/Tasks has been removed
Updated mime.php and mimePart.php in line with mail_mime 1.8.5
==============================================================
Updated mime.php and mimePart.php in line with mail_mime 1.8.5 which contains
a fix for a bug we reported upstream concerning decoding headers. Only change
from standard PEAR versions is removal of dependence on PEAR::isError
Fixed messageclass for Meeting Replies/Cancellation
===================================================
Following explanation of an issue with another backend on the z-push forum
a more granular (and correct) messageclass breakdown has been added
Fixed timezone object creation issue that broke timezone matching on android
============================================================================
Fixed timezone object creation issue that broke timezone matching on android
and resulted in DST changes moving recurring appointments.
Zimbra stores the day of the week starting at 1. However, the timezone object
needs the day to start at 0.
This difference broke the timezone matching algorithm on android and resulted
in timezones without daylight savings getting picked instead of those with it.
This would cause recurring appointments to jump an hour after the DST change.
Added sendasemail directive, and fixed regression in SendMail
=============================================================
Added sendasemail directive that can be used to change the sender's email
address when SmartFolders is configured. Note that if ZIMBRA_ENFORCE_VALID_EMAIL
is set to true - the configured email address will be overridden if is not a
valid zimbra alias for the user. Also, fixed regression in SendMail to force
use of _SendAsEmailOverride when configured by the user (directive or XML)
Change SendMail to pass through encoded headers
===============================================
Some phones pass through headers that are already encoded for 7-bit transport.
This change passes them through as they are rather than decoding them. This
should correct some problems with non-ascii characters in the To address,
Subject, etc.
Added code to allow for not receiving a From: header or receiving an empty one
==============================================================================
Added code to allow for not receiving a From: header or receiving an empty one.
Some devices do not include any From: header at all in the message they send,
while others have been found to send From: with no address after it. This fix
will look for both situations, and add a From: header using the the user's
preferred name/address
Added code to encode From: header - if not encoded in _SendAsNameOverride
=========================================================================
Added code to encode From: header. This is to allow non-ascii characters to
pass through in the sender's name. Note that this should now properly encode
the user's name from their zimbraDisplayName. If the user has specified an
override name through a SmartFolder directive or an XML file, this will be
checked to see if it is already in an encoded format - and will encode it
if it is not.
Added basic check for incompatability between z-push and backend versions
=========================================================================
Added basic check for incompatability between z-push and backend versions. As
a result of the number of questions opened by users who have installed z-push
2 without updating the zimbra backend - I have added a basic check that will
log to the debug log file if it detects that the backend is not compatable
with the z-push version.
For Z-PUSH-2
============
The following changes reflect the considerable architecture changes between
z-push 1.5 (and the as12.1 branch derived from it) and the new z-push-2
Fix regression regarding inline image only emails introduced in 53.7.z-push-2
=============================================================================
Fix regression regarding inline image only emails introduced in 53.7.z-push-2
Fix truncation logic for BodyPreference[1] and [2]
==================================================
Reworked body fetching and added truncation checks based on BodyPreference
BatchRequest plain and/or html bodies into a single SOAP Request
================================================================
If BodyPreference is supplied then request whichever body/bodies are
requested (1 and/or 2) in a single BatchRequest SOAP call
Change to JSON for SOAP response processing
===========================================
For z-push-2 change to JSON for SOAP response processing - with the exception
of non SmartFolders folder initialization which uses a linear array to process
folders instead of a nested one. The MakeXMLTree function was mangling HTML
contained within XML nodes, and making it difficult to process.
Remove Provisioning support code
================================
For z-push-2 remove Provisioning support code. As z-push-2 now has it's own
built-in privisioning support and no longer calls the functions previously
supplied by the backend - this code is being removed.
Remove AlterPing support code - replaced with ChangesSink
=========================================================
Though initially changed in Release 53 - this change is worth highlighting again
as it is significant, and to highlight the fact that a fix is available for the
previously mentioned bug in zimbra 7.2
For z-push-2 the old AlterPing method of detecting changes at the backend is no
longer supported so the related code is being removed. A new change detection
scheme, ChangesSink, has been introduced to replace it.
ChangesSink for zimbra depends on a SOAP call CreateWaitSetRequest which appears
to have deadlock issues in some versions of zimbra though I have not encountered
the problem during testing. See bug 74437 in the zimbra Bugzilla for more
information. This is fixed in 7.2 Patch 1, and the fix will be rolled into 7.2.1
I have no idea if this function has potential issues with zimbra Release 6.0.nn
For z-push-2 remove getSettings/setSettings - add Settings
==========================================================
For z-push-2 the getSettings/setSettings backend functions that were added for the
as12.1 branch support are not used so the code has been removed. z-push-2 instead
uses a single backend function Settings that combines the functionality of both
For z-push-2 report protocol version supported as 14 (ZPush::ASV_14;)
=====================================================================
For z-push-2 report protocol version supported as 14 (ZPush::ASV_14;) even
though SMS sync is not supported - this version is needed for attendee
status updates to be shown on the device
There is ongoing work on the z-push-2 server side to handle calls to sync SMS even
if SMS sync is not available in the backend.
For the moment though it is best to UNCHECK [ ] Sync SMS/Text Messages on your
device when setting up sync.
For z-push-2 rename function ItemOperationsEmptyFolderContent to EmptyFolder
============================================================================
For z-push-2 rename function ItemOperationsEmptyFolderContent to EmptyFolder
This function was previously added to support the as12.1 branch though the hooks
were never added by the branch developer to call the function. z-push-2 uses the
new name for the function
For z-push-2 fixed SendMail to check for content before setting parameters
==========================================================================
For z-push-2 fixed SendMail to check for content before setting parameters to
avoid "SyncMail: parameter 'reply_to' contains an invalid email address ''"
z-push 1.5 used to handle these settings silently so it was never an issue. With
z-push-2 each instance is flagged with log entries so pre-screening has been added
For z-push-2 attachment->filereference has to be bin2hex encoded
================================================================
For z-push-2 attachment->filereference has to be bin2hex encoded so that part
numbers for subparts/attachments do not lose their "." separators in the new
"evil" filters in request.php
Previously the attachment filereference could be sent to the device in plain text.
For example, 2:12345:2.1 represented folder 2, message 12345, MIME part 2.1
The new z-push-2 evil content filter strips out the "." character which left any
device requesting part 2.1 of the message generating a backend lookup for part 21
instead. This would either fail completely or in the unlikely event that there
were 21 parts to the MIME message would return the incorrect part to the device.
bin2hex encoding the filereference and then hex2bin decoding it whenever a request
is made to retrieve it was suggested by the z-push-2 developers as the way to work
around this issue.
For z-push-2 add Utils:: prefix to call to function GetOLUidFromICalUid
=======================================================================
Having eliminated the dependency on a local copy of the as12.1 utils.php file, this
call needs a prefix to identify the function as being in the z-push-2 Utils class
For z-push-2 fix notes handling for AS12+ appointments/tasks
============================================================
For z-push-2 fix notes handling for AS12+ appointments/tasks - keep original
notes if not updated - this fix is as a result of WM6.5 not sending over any
updates to the description fiels for appointments/tasks
For z-push-2 add function GetUserInfo and move code from Logon
==============================================================
For z-push-2 add function GetUserInfo and move code from Logon into it to
ensure user profile info is known prior to calling GetUserProfileXML.
The refactoring of the logon and setup routines had broken the processing
of user's email addresses for those using XML files.
For z-push-2 Fixed extract of $id on contact creation to stop looping
=====================================================================
For z-push-2 Fixed extract of $id on contact creation to stop looping on
new contact created on the device. The code to extract the newly created
server contact id was not correct, so it was returning false to the device
which was then retrying to send the new contact over. This loop would
duplicate the contact on the server over and over
For z-push-2 refactored GetMessageList into a single switch block
=================================================================
For z-push-2 refactored GetMessageList into a single switch block in order
to simplify the implementation of local cacheing
For z-push-2 added local caching of MessageLists to reduce server load
======================================================================
For z-push-2 added local caching of MessageLists to reduce server load on
initial sync where the same unchanged lists will be queried repeatedly
within a short space of time. The default is for this feature to be enabled
with each folder cache having a lifetime of 3600 seconds.
This feature is enabled by default - but can be disabled by adding a new
config.php directive
define('ZIMBRA_LOCAL_CACHE', false);
The cache for each folder has a default lifetime of 3600 seconds. This can
be adjusted by adding an additional directive
define('ZIMBRA_LOCAL_CACHE_LIFETIME', 300);
For z-push-2 changed debugLog to ZLog::Write and adjusted logging levels
========================================================================
For z-push-2 changed debugLog to ZLog::Write and adjusted logging levels for
errors in Logon so that obvious issues are highlighted without debug being on.
For example, if php-curl is not installed OR if the ZIMBRA_URL is not defined
the sync cannot work. These will now be logged at a FATAL level. Other entries
have been set at INFO level so they get logged on a default install.
For z-push-2 added delay logic to ChangesSink in event of loss of connectivity
==============================================================================
For z-push-2 added delay logic to ChangesSink in event of loss of connectivity
to the host. This is to prevent the code from looping trying to create a
WaitSet. If the ChangesSink was supposed to be for 60 seconds, and the CURL
return shows a problem connecting to the backend, the code will simply delay
for the 60 seconds before returning control back to z-push
Changes Made To Revision 53:
- Implemented ChangeFolder and DeleteFolder
- Don't send invitations/updates for meetings created/modified on Apple iPxxx
devices, as device is sending them directly
- Fixed set 'active' settings for document/wiki to false in GetUserProfileXML
- Fixed debug log error in ReportMemory and report "Unavailable" when function
to return memory usage is not found
- Mail folders (at least) on servers upgraded from earlier versions of zimbra
do not have the view property set - default it to "message"
- Update SmartFolder handling to use defaulted "view" for efficiency
- Added support for storing lastsyncip in provisioning table
- Removed domain portion of userid (if supplied) in provisioning functions
- Move creation of SyncMeetingRequest object up to avoid "Creating default
object from empty value (2048)" error
- Split bodyPreference Wanted message over two debugLog lines to avoid
undefined index error in debug log
- Added missing truncation choices in GetTruncsize function - Defined constant
values not used so as not to deoend on zpushdefs.php getting updated
- Fix for sender email address corruption when ZIMBRA_ENFORCE_VALID_EMAIL is
not defined - or not true
- Removed subtype from debug line in GetAllBodyRecursive
- Added back contentlocation for Attachments and revert change to attoid as
attachments were not opening correctly or were disappearing from the emails
on the device
- Fixed SendMail for z-push-2 - Use SyncSendMail object as only parameter
- For z-push-2 - Use WaitSet's for triggering push
- For z-push-2 - bump limit in GetMessageList to 500 from 100
- For z-push-2 - Change GetMailboxSearchResults to work with CPO object
Implemented ChangeFolder and DeleteFolder
=========================================
Implemented the server operations ChangeFolder and DeleteFolder
Don't send invitations/updates for meetings created/modified on Apple iPxxx
===========================================================================
Apple iPxxx devices send meeting invitations directly from the device. For
all normal meeting invitations/updates zimbra will send emails to all invitees
automatically on saving the meeting. A change has been added to detect the
UserAgent of the device creating/changing the meeting, and if it is an Apple
device to bypass the sending of the emails from Zimbra. This stops the
duplication of invites/updates.
There is a known side effect though that the sender name cannot be updated
as it normally would - so the email will usually have only an email address as
the From: person - not "Joe Sender" joe.sender@wherever.com
Unfortunately the Meeting Acceptance API does not have the same switch
available to eliminate sending duplicate acceptances/rejections of meetings
from Apple devices.
Fixed set 'active' settings for document/wiki to false in GetUserProfileXML
===========================================================================
For previously upgraded zimbra systems, there can still be folder types of
document and wiki. There was no default set for these folder types in the
User XML handling code. This has been added.
Fixed debug log error in ReportMemory and report "Unavailable"
==============================================================
A fix was added to report "Unavailable" rather than an error message if the
PHP extension to gather memory statistics is not available on the server.
Set default view property of folders to "message"
=================================================
Mail folders (at least) on servers upgraded from earlier versions of zimbra
do not have the view property set - default it to "message" if it does not
already have a view property.
Update SmartFolder handling to use defaulted "view" for efficiency
==================================================================
The SmartFolder handling code was able to be streamlined as a result of
knowing that all folders would have a "view" property - a knock on benefit
from the previously mentioned fix.
Added support for storing lastsyncip in provisioning table
==========================================================
For z-push 1.5.x and as12.1 branches, the zimbra backend provisioning functions
can be enabled. One user requested the addition of the last synced IP Address
to the provisioning table. This was added to the backend - but not as yet to the
provisioning GUI.
Removed domain portion of userid (if supplied) in provisioning functions
========================================================================
In the case where a full DOMAIN\username is entered on the device, the presense
of the "\" was seen by one user to cause problems for the provisioning GUI pages.
A change was made to only pass the username to the backend database.
Move creation of SyncMeetingRequest object up
=============================================
The creation of SyncMeetingRequest object was moved up to avoid "Creating
default object from empty value (2048)" error
Split bodyPreference Wanted message over two debugLog lines
===========================================================
For as12.1 the backend could receive a bodyPreference Wanted indicator - or not
depending on the device synching. If this was not sent to the backend an
undefined index error in debug log. This debug has been split over 2 lines so
as to check for the presence of the wanted flag prior to logging what it is set
to.
Added missing truncation choices in GetTruncsize function
=========================================================
The GetTruncation function was not handling all possible values being sent from
the device. A fix has been added to support the missing values. Note that hard-
coded values are checked rather than defined constant values - so as to make sure
the fix is not dependant on zpushdefs.php getting updated. A bug report on the
base problem has been raised with z-push.
Fix for sender email address corruption
=======================================
A fix was added to prevent the From: address getting corrupted when
ZIMBRA_ENFORCE_VALID_EMAIL is not defined - or not true.
Removed subtype from debug line in GetAllBodyRecursive
======================================================
The subtype is no longer passed to GetAllBodyRecursive - so when the
ZIMBRA_DEBUG flag was set, the log entry for the function would write an error
to the debug.txt file.
Added back contentlocation for Attachments and revert change to attoid
======================================================================
A change made in Release 52 to support the sending of images from iOS5 devices
caused an unexpected problem with som other attachments. This would manifest itself
as an email in the devices list appearing to have attachments - but when clicked on
they would not download. On closing the email and going back into it the attachments
would no longer show as being available.
A change was made to add back the contentlocation property for Attachments and
revert change to attoid as attachments were not opening correctly or were
disappearing from the emails on the device.
There may still be some issues with some attachments - but this should behave a
great deal better than Releae 52.
For Z-PUSH-2
Fixed SendMail for z-push-2 - Use SyncSendMail object as only parameter
=======================================================================
Z-PUSH-2 has changed the function definition of the SendMail function. A change
has been made to bring the z-push-2 version of the backend into line with the
now current function definitions.
Use WaitSet's for triggering push
=================================
Z-PUSH-2 no longer uses the AlterPing methodology for detecting changes at the
server. A new ChangesSink methodology has been introduced instead. The backend
has been updated to use zimbra WaitSets - which should reduce the load on the
zimbra server. Note that zimbra 7.2.0 has a bug in WaitSets that is due to be
fixed in 7.2.1
Bump limit in GetMessageList to 500 from 100
============================================
To reduce the number of backend hits for large mailboxes - the maximum number
of rows that can be handled per backend request has been increased from 100 to
500 in GetMessageList
Change GetMailboxSearchResults to work with CPO object
======================================================
Z-PUSH-2 has changed the function definition of GetMailboxSearchResults to only
use a single CPO object. A change has been made to bring the z-push-2 version
of the backend into line with the now current function definitions.
Changes Made To Revision 52:
- Fixed length encoding in GlobalObjID that caused duplicated meetings, and
broke meeting updates - Fix can't update bad meeting IDs already on device
- Fix to use client generated UID for new appointments created on the phone
to avoid duplication of the appointment in the calendar
- Fix to strip Email Name from email address on contact sync - android issue
- Changed handling of virtual folders for Apple devices as they have a non-
standard ability to display multiple Calendars and Multiple folders of
contacts natively. This change will allow all Calendar and Contact folders
to be synced to Apple devices. I have tested WM 6.5, Samsung android 2.3.3
and Nokia, and none of them can support this functionality. If anyone knows
other devices that have this native capability, let me know and I can add
exceptions to the code for them as well. To turn off this feature two new
switches have been defined for config.php - ZIMBRA_DISABLE_MULTI_CALENDARS
and ZIMBRA_DISABLE_MULTI_CONTACT_GROUPS - see below for details
- Fixed Plain Text attachments getting appended to plain text body
- Fixed Attachments/Images for MIME formatted messages
- Added HTML/MIME formatted message support for iPhone using z-push 1.5.x -
Setting the ZIMBRA_HTML flag to true should now send MIME to the device when
requested by the device (mimesupport 2 requested).
- Fixed S/MIME Support. S/MIME messages now sent to device when mimesupport 1
received from device.
- Changed meetingstatus to 1 (Is a meeting) from 0 for appointment sync
- Added new optional config.php setting ZIMBRA_MB_DETECT_ORDER to allow
overriding of the default list of charsets. See notes below.
- Change to GetHTMLAttachmentsRecursive to allow for content-type header that
has no primary/secondary type included
- Added 86400 second offset to message $cutoffdate as zimbra search works
from midnight and just using $cutoffdate turned into a date string was
dropping all emails from 3rd day back. Now seach returns today, and all of
previous 3 days/7 days/14 days etc.
- Changed $revision to $GLOBALS['revision']
- Added optional configuration ZIMBRA_DETECT_RUSSIAN to allow support of the
Russian language. Requires include file a.charset.php
- Fix for Modify Appointment function ConvertItemIdToInvID to use
GetAppointmentRequest instead of SearchRequest which was sometimes unable
to find all appointments
- Fix to only send InstanceType for meeting Request - not for Notification
- Fix for GetAttachmentData and ItemOperationsGetAttachmentData to check if the
attachment is in a Shared Mailbox and handle $attname differently.
- Fix for GetAttachmentData to not output a content-type header, as request.php
is already sending a generic application/octet-stream content type header.
Also added output Content-Length header, and use echo instead of print
- Fix added to GetMpBodyRecursive for handling inline images from iOS5
- Replaced GetBodyRecursive with GetAllBodyRecursive to streamline processing
- Uncomment addHTMLImage call in getHTMLAttachmentsRecursive
- Fix added to SendMail to handle attachments on SmartForward requests
- Fix added to StatMessage to detect Shared Contacts
- Fix added to GetMessage to search for the folderid if not supplied
- Added handling of new *SyncConfig* directive "sendasname" to override the
name retrieved from zimbra (see below for details)
- Removed hard limit of 1MB from Fetch function
- Added instructions for selected user debugging with ZIMBRA_DEBUG flag
- Added function ItemOperationsEmptyFolderContent for as12.1 branch to
enable 'Empty server trash' command from the device
- Added function ResolveRecipients for as12.1 branch
- Updated Search function to allow for a subset of search parameters being
sent over from the device for as12.1 branch
In addition - for z-push-2 alpha - the following additional changes have been made
- First port of backend to z-push-2 architecture
- Added _deviceAgent, and changed code to work with _deviceAgent instead of
$GLOBALS['useragent'] for z-push-2
- Moved Search functions into a separate class for z-push-2
- Added function GetGALSearchResults for z-push-2
GlobalObjID Encoded Length Fix
==============================
In Release 51 a change was added to try to address calendar item duplication
and the failure of the device to recognise updates to calendar items on some
devices. That fix had an error in the way it encoded the UID length within
the GlobalObjID. This has been corrected.
Use Client Generated UID
========================
When new meeting requests are sent from the phone, it generates a UID for the
meeting. Zimbra will allow the use of a client generated UID in a new meeting
creation request, so a change has been added to now use the UID from the phone.
This should finally stop the duplication of meetings.
Strip Display Name from Email Address
=====================================
When a contact is changed on an Android phone (and possibly others) it sends the
email address back in the format "Full Name" <account@domain.com> - this causes
problems on zimbra. A fix has been added to strip off the name.
Multi-Folder Support Added (for Apple iOS)
==========================================
Apple devices have the ability to handle multiple calendars and contact folders
natively. If an Apple device is detected, the additional coneacts and calendar
will not be "virtually included" into the default folders Contacts and Calendar
but will instead be sent across in their own folders.
If anyone is aware of any other devices that support this capability, please
post a message on the Support Requests Tracker so we can add a check for that
device to the code.
To Disable the breaking out of Calendars and Contact Groups on devices
----------------------------------------------------------------------
By default, if an Apple device is identified, Calendars and Contacts in custom
folders will be passed to the device in separate calendars/folders. This allows the
device user to select what they want to display. It potentially increases the load
on the backend to have to sync a lot of folders though. In order to prevent devices
synching many different folders, the administrator can disable the support of
multiple calendars and/or multiple contact folder using these two switches.
define('ZIMBRA_DISABLE_MULTI_CALENDARS',true);
define('ZIMBRA_DISABLE_MULTI_CONTACT_GROUPS',true);
Note that if either feature is disabled, the behaviour of the backend will return to
that which was in place before the breakout ability was added. i.e. all items will get
virtually included in the primary folder (assuming virtual support is turned on)
Fix Plain Text Attachments
==========================
A fix has been added to stop text/plain attachments from being appended to the
plain text body of an email. They should now appear correctly as attachments.
MIME Image/Attachment Now Handled
=================================
The handling of Images and Attachments in a MIME formatted message has been
re-worked, and should hopefully now work correctly.
HTML Email for IPhone using z-push 1.5.x
========================================
Support for HTML (actually MIME) email for iOS devices has been added. This is
controlled by the ZIMBRA_HTML flag which has never worked correctly up until now.
If your device requests MIME formatted email, and the ZIMBRA_HTML flag is set to
true, then we will now send MIME to the device. Thsi will allow the device to
display full HTML email.
S/MIME Support
==============
S/MIME messages will now be sent to device unaltered when a mimesupport 1
request is received from device.
MeetingStatus Flag Changed
==========================
The meetingstatus flag on appointments was changed from 0 (unknown) to 1 (meeting)
MB Encoding Detection Extended by 24hrs
=======================================
A Japanese user had an issue with the character set encoding detection that was
causing them to get garbled emails. After troubleshooting the issue it was
identified that a more flexible method of supplying character sets to the
decoding algorithm was needed.
A new optional config.php setting ZIMBRA_MB_DETECT_ORDER has been added to allow
overriding of the default list of charsets ('ASCII, UTF-8, ISO-8859-1, ISO-8859-15')
If you wish to use a different set of charsets - or to change the detection order
then simply add a new definition to the config.php file - for example - the Japanese
user used the following override
define('ZIMBRA_MB_DETECT_ORDER','ASCII, ISO-2022-JP, UTF-8, ISO-8859-1, ISO-8859-15');
which correctly detected the Japanese encoding of emails for them.
See PHP documentation for mb_detect_order for details. Be careful of the sequence of
charsets - as the detection will stop as soon as it finds a possible match - even if
a later charset in the list is the correct match.
Note: I am still working with a Russian user looking for a workaround for the fact
that the inbuilt PHP functions do not detect cyrillic encodings.
Attachments with no primary/secondary content-type
==================================================
Some phones (Cyanogenmod android) add attachments with a broken content-type header.
The code was dropping these attachments. A fix has been added to check for this
condition, and to add the attachment as unknown type.
Message/Calendar Filter Windows Extended
========================================
When a user selects for example - email for last 3 days - on their phone, z-push
uses a rolling 3-day (or 72 hour to be exact) window to determine what messages to
send to the phone. The filtering on zimbra behaves slightly differently, however,
and it would filter based on the day - not the actual time of day. So, on the phone
you would always get today, yesterday and the previous day. You would not get the
messages from the messages from the third day back that were still within the 72-hour
window. A change has been made to err on the side of showing too many rather than too
few messages - so the code will now add an extra day of messages to all selection
criteria. So, now the seach returns today, and all of previous 3 days/7 days/14 days,
etc.
Use $GLOBALS['revision'] instead of $revision
=============================================
Some systems were not properly reporting the revision in the logs. Adding the $GLOBALS
wrapper addresses this.
Added option to handle Russian encoding
=======================================
The normal mbstring functions cannot identify Russian encodings - as they are not a
character set - but rather an encoding. The default behaviour of the zimbra backend
mangles the Russian characters as a result of this. Working with a russian user we
have found a reliable php script on the internet that can identify the different
Russian encodings, and convert the text into Windows-1251 which the zimbra backend
knows how to handle. If you wish to use this functionality, you will need to download
the file a.charset.php from the SVN (misc folder) and place it in the include folder
on your z-push installation. Then add the option key
define('ZIMBRA_DETECT_RUSSIAN', true);
to the config.php file.
Fix for Modify Appointment
==========================
In some instances the SearchRequest function would not find a Calendar appointment
so when the user tried to change an appointment from their device, the modification
would fail. A fix has been made in the function ConvertItemIdToInvID to use the SOAP
call GetAppointmentRequest instead as this appears to be a more reliable method to
get the appointment Id.
Fix for Meeting Notification - Remove InstanceType
==================================================
Fix to only send InstanceType for a meeting Request. Previously it was also being
sent for Meeting Notification messages as well.
Fix for GetAttachmentData and ItemOperationsGetAttachmentData - Shared Mailbox
==============================================================================
A fix was added to GetAttachmentData and ItemOperationsGetAttachmentData to
check if the email is in a shared mail folder and handle it appropriately. The
supplied $attname is normally a 3-part identifier - FolderId:MessageId:MessagePart -
however, in the case of a shared mail folder, the MessageId element itself contains
a : separator between the userid of the user who shared the mail folder, and the
MessageId for that user.
Fix for GetAttachmentData to not output a content-type header
=============================================================
Fix for GetAttachmentData to not output a content-type header, as request.php
is already sending a generic application/octet-stream content type header.
Also added output Content-Length header, and use echo instead of print
Fix added to GetMpBodyRecursive for handling inline images
==========================================================
Fix added to GetMpBodyRecursive for handling inline images contained in emails
sent from iOS5 primarily. The images are contained in MIME part identified as an
inline image - but the image is not referenced anywhere within the body of the
email. The parent MIME type is multipart/mixed.
The fix, adds a placeholder for the image if it is building an HTML mail body and
adds the image as an attachment. The resulting parent container is of type
multipart/related.
This may be re-worked again in a future release if a better way to handle it can
be found.
Replaced GetBodyRecursive with GetAllBodyRecursive to streamline processing
===========================================================================
Multiple calls to GetBodyRecursive have been replaced with a single call to a
replacement function GetAllBodyRecursive. This allows for better handling of
multipart messages - particularly those containing inline files
Uncomment addHTMLImage call in getHTMLAttachmentsRecursive
==========================================================
The call to addHTMLImage in getHTMLAttachmentsRecursive has been uncommented as
it was found to be necessary in order to get all inline images to get sent to
the device
Fix added to SendMail to handle attachments on SmartForward requests
====================================================================
A fix has been added to SendMail to handle attachments on SmartForward requests.
SmartReply requests will not include the attachments - so the user should forward
the email back to the original sender and add other recipients - if they wish to
pass on the original email with comments added, and with the attachments included
Fix added to StatMessage to detect Shared Contacts
==================================================
A fix has been added to StatMessage to detect Shared Contacts and to handle them
appropriately. The ownerId of the user who shared the contact needs to be included
in the item Id for any contact update request.
Fix added to GetMessage to search for the folderid if not supplied
==================================================================
Some GetMessage requests were being received with no folderId included. In the
absense of a folderId, it is not possible to identify the type of item we are
processing - i.e. message/contact/appt/task. A fix has been added to GetMessage
to search for the folderid using the item Id if the folder Id is not supplied
Removed hard limit of 1MB from Fetch function
=============================================
An arbitrary limit of 1MB has been removed from the Fetch function to avoid
breaking the fetch for large attachments
Added instructions for selected user debugging with ZIMBRA_DEBUG flag
=====================================================================
Added instructions to the notes at the top of the zimbra.php file for selected user
debugging with ZIMBRA_DEBUG flag - the feature was added back in release 48 and was
documented in the release notes as follows
- Added option to define ZIMBRA_DEBUG as 'user1' or 'user1,user2,userN' to
enable zimbra soap debug messages for just the listed accounts. Defining
it as true/false will continue to work as before
Added function ItemOperationsEmptyFolderContent for as12.1 branch
=================================================================
Added function ItemOperationsEmptyFolderContent for as12.1 branch to enable
'Empty server trash' command from the device. This is used where a user who is
remote from their office has exceeded their mailbox quota, and they need to free
up some space to allow emails to come into their mailbox. The functionality will
not work until the z-push as12.1 branch adds a handler to call this code. I have
requested this from the developer.
Added function ResolveRecipients for as12.1 branch
==================================================
Added function ResolveRecipients for as12.1 branch. This function verifies email
addresses against the backend
Updated Search function for compatability with newer devices
============================================================
Updated Search function to allow for a subset of search parameters being sent
over from the device for as12.1 branch. For example the Samsung phones running
android 2.3.6 can send start/end date ranges, folder id, etc.
New *SyncConfig* directive added - sendasname
=============================================
Added handling of new *SyncConfig* directive "sendasname" to override the
dispalay name retrieved from zimbra. This was primarily added to counteract the
corruption of the sender name in emails where non-ascii characters are included
in the sender's name - To counteract this the sendasname value can be set to what
it would be if correctly MIME-encoded.
To get the correctly formatted name, send yourself an email through the web
client, and then right-click on the received email and Show Original. Look for
the From: header and copy the name from there. Don't include the email address
part - or any surrounding "" marks. Note that the encoding zimbra uses will most
likely be utf-8 rather than ISO-8859-1 as seen in the following example
For example
=?ISO-8859-1?Q?Andr=E9?= Pirard
The example above is taken from the rfc2047 document, and appears in a CC:
CC: =?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>
For reference: http://www.faqs.org/rfcs/rfc2047.html
z-push-2 - alpha release
========================
In addition - for z-push-2 alpha - the following additional changes have been made.
This code is still in early testing as is z-push-2 and will need to change in line
with the constant changes being made to z-push-2 at the moment. Hence it is not
being released in svn at this time.
- First port of backend to z-push-2 architecture
- Added _deviceAgent, and changed code to work with _deviceAgent instead of
$GLOBALS['useragent'] for z-push-2
- Moved Search functions into a separate class for z-push-2
- Added function GetGALSearchResults for z-push-2
Changes Made To Revision 51:
- Added attendee status/type information to appointments
- Changed GlobalObjID to be correct non-outlook encoded value so that Apple
and possibly other devices will update appointments correctly
- Changed handling of invitations for client generated meetings - zimbra will
always send out invitations now (even for Apple/Android) - but if zimbra is
the default email client on the device, we will drop the device originated
invitation once it is received by SendMail. If another email account is your
default account then the device will send a "duplicate" meeting invitation
directly through that email account. Replies to the device originated
invitation may not correctly update the attendee status of the appointment
on the original device
- Fixed as12+ body handling for Appointment/Contact/Task
- Changed handling of birthday/anniversary field to try to get a solution
that will work for most scenarios
- android 2.3.3 seems to have a serious problem with the birthday field that
causes it to spin constantly trying to resync the calendar - limiting
birthday to known UserAgents for now (Apple and MailforExchange)
- Experimental fix in Logon to delay and retry logon attempts when the
zimbra server is not available (eg. zimbra FOSS shut down for backup)
See ZIMBRA_RETRIES_ON_HOST_CONNECT_ERROR in the notes below.
- Fix to add missing $this-> prefix to ScrubHtmlText in function
GetMpBodyRecursive
- Added fix to AlterPingChanges to detect changes in Virtual Folders
- Added output the Conversation ID field to allow view by conversation
on some Android devices (WM appears to need more to work)
- Cosmetic fix in GetSearchResults to avoid logging error when GAL search
returns zero matches
- Added 'wiki' folder type for SmartFolder setup to accomodate servers that
are running, or once ran, version 5.0.x of zimbra
- Removed Nokia only filter on adding FakeOutbox folder, as Android 2.3.3
seems to need it too, and it doesn't appear to break other phone syncs
and renamed the devid to FakeOutbox from NokiaFakeOut
- Added path to fake outbox structure to fix debug log error
- Save SOAP error extracted from response to $this->_soapError for
decision making in calling routine
- Removed 'Too big for inline?' debug message
- Reworked Sendmail address checking
- Revised non-plain text email handling in GetMessage
- Reverted text/html encoding to base64 from quoted-printable for mime body
as the majority of incoming messages use base64
Attendee Status & Type
======================
The status (Accepted/Tentative/Declined/Unknown) and type (Required/Optional/Resource)
information for meeting attendees are now pushed out to the device.
Changed Global Object ID handling
=================================
In some cases, zimbra meeting updates were not properly updating the client device.
Changed the handling of the GlobalObjId field to encode it as a "non-Outlook" ID to
improve the update reliability
Meeting Requests and Duplicate Invites (Apple and Android??)
============================================================
Having struggled to understand the behaviour of the Apple iP*** devices and their
handling of meeting requests, I was finally able to get access to an iPod (4.3) to
test with.
What I discovered is that whenever you set up a meeting on an Apple device, the
device will create the meeting on the server, and once it gets confirmation that the
meeting was created successfully, it will then send out emails directly from the
device to the invitees in a 3-part MIME message inviting them to the meeting. The
third part of the MIME message is of type text/calendar and contains an ICS meeting
request. Zimbra by default also sends out meeting requests - so the recipient will
end up receiving 2 separate invites to the same meeting.
I also found that if I accepted the meeting request sent from the device directly,
it did not update properly update the meeting attendee status for the meeting.
For these reason, I have decided to adopt the following processing rules.
1. zimbra will be allowed to invite participants to all meetings
2. if the device-originated invitations are sent through zimbra - I will drop them
without actually sending the email to the recipient.
This apporach gives the best outcome in terms of allowing for correct handling of
replies to the meeting request, and status updates, etc.
There is still no way to intercept the duplicate meeting invitation from the device
however, if it is configured with multiple email accounts, and it routes the
direct invitation out through one of the alternatie accounts. I believe you can
select the "Default Account" in the Email settings on the Apple devices to force
email to go through the ActiveSync account as a preference - which would allow all
duplicate invites to be caught and dropped.
Fix AS12+ Body Handling
=======================
Just as AS12+ brought with it the ability to specify the preferred content of emails
it also brought the same ability to Appointment/Contact/Task body fields. This release
fixes the handling of the body field when an AS12+ server is being used.
Changed handling of Birthday/Anniversary
========================================
In troubleshooting a birthday field issue raised by an iPhone user, I found the
original scheme employed in the code to try to ensure the date conversion would always
work was causing issues with the iPhone. Whatever date the user set on zimbra would
get incremented by one day on the iPhone. After some experimentation I think I have
found an alternative thet will work more reliably with most if not all phones. This
has been implemented. (See also Birthday Field Breaks Android 2.3.3 Sync below)
Birthday Field Breaks Android 2.3.3 Sync
========================================
Having done extensive troubleshooting over a number of months on an issue where my
own phone, having been updated to android 2.3.3, began to constantly sync the
calendar regardless of the ActiveSync "ping" settings, I finally stumbled on the
solution to the problem while working on the iPhone Brithday issue above.
It seems that Android 2.3.3 does not like the birthday field as presented by z-push
/zimbra. I have no way to know if a real Microsoft Exchange Server birthday field will
behave the same way - but I assume it will. If the birthday field is present on the
server, the Calendar on the phone will constantly sync - connecting every minute -
which will run up data charges and drain the battery rapidly on the device. I assume
the calendar is trying to look for, or create a "birthday" appointment with which to
sync - but nothing happens other than the constant spinning.
For this reason, I have limited the devices that the birthday field will sync to to
those devices I know do not have such problems. Nokia (MailforExchange) and Apple
are the only unique UserAgent strings I have been able to allow to work for now.
For any other device, the contact record will still sync, just the birthday field
will not be sent to the device.
Experimental fix in Logon to delay and retry logon
==================================================
Like many Zimbra FOSS users, we use a backup script from the Administrators forum
that requires zimbra to be shutdown briefly to do a cold-sync backup. For some
mobile devices, if they try to initiate a connection to the server during that
period, they will spin quickly retrying and will then give-up. Other devices try
again after a period of time has elapsed.
This experimental fix has been put in place to allow a few minutes for the server
to become available again so that the device does not get into this "I've given up"
state. It has been working well for me.
To enable the functionality ass a new definition in the config.php file
define('ZIMBRA_RETRIES_ON_HOST_CONNECT_ERROR',5);
and set the value appropriately for your system.
I am not aware of the tolerance of phones towards communication delays - hence the
experimental label.
Fix for ScrubHtmlText
=====================
A fix has been implemented to add missing $this-> prefix to ScrubHtmlText in function
GetMpBodyRecursive. This bug was causing the script to terminate in the event that
the phone requested text output, but the email was in HTML only.
Fix for "Ping"ing Virtual Folders
=================================
A fix was added to AlterPingChanges to detect changes in Virtual Folders. These
folders are treated as extensions of the main Calendar/Tasks/Contacts folders,
and their content is synched over to the equivalent folders on the phone. However,
an issue was identified whereby a change to an item in the virtual folder would not
trigger a resync of the folder. This has been fixed.
A word of warning for anyone who shares folders among very large groups of users is
that all users would get the notification to sync within the same 5 second time
window - and this could add extra load spikes to your Apache and/or Zimbra servers.
Conversation View (partial support)
===================================
While zimbra does not support the full conversation view history that Exchange does,
adding the Conversation ID at least allows some phones to group emails together
correctly by Conversation. This has been tested under the as12.1 configuration
using an android 2.3.3 phone and an iPod. Note that it did not allow Windows Mobile
6.5 to display messages by conversation. Iam not aware of how or even if it will
work on any other phones.
GetSearchResults logging fix
============================
A cosmetic fix has been added in GetSearchResults to avoid logging error when GAL
search returns zero matches
SmartFolders - Added wiki folder type
=====================================
While troubleshooting a different issue for a user, I noticed in the log that there
was a wiki folder type on their system. This occurs if the server has been upgraded
all the way from zimbra 5 or earlier. I added entries for the 'wiki' folder type
to the Smart Folders initialization block to accomodate these conditions.
Fake Outbox Now Universal
=========================
The Fake Outbox that was introduced on an experimental basis originally to allow
some newer Nokia phones to sync proved to work well with all newer Nokia phones
without breaking the sync for older Nokia phones.
With the update to android 2.3.3 it seems that android now also needs to see an
Outbox before it will sync correctly to a server.
For this reason, the check of a Nokia UserAgent string has been removed, and now
all devices will get a Fake Outbox folder listed in their Sync setup.
The internal folder name has been changed from NokiaFakeOut to FakeOutbox to
make it clear that this is not longer a Nokia specific feature.
Also, a "path" element was added for the FakeOutbox to fix a debug log error
Save SOAP Errors
================
Code was added to save any SOAP errors extracted from zimbra server responses to
$this->_soapError for decision making in the calling routine. This is used in
conjunction with the Logon retry logic detailed above.
Removed 'Too big for inline?' debug message
===========================================
The 'Too big for inline?' debug message was added to the code during development
to check if the size of attachments was larger than the config.php setting for
MAX_EMBEDDED_SIZE. This debug message has been removed.
Reworked Sendmail address checking
==================================
The checking of the validity of the sender's email address has been reworked.
If the setting ZIMBRA_ENFORCE_VALID_EMAIL is defined and set to true, the code
will now check if the sender's email address is either the user's primary or
a validly configured alias for that same account. It does not look for any other
External Email Accounts that may have been set up by the user in their Web Client.
If the email address is not valid it will be replaced by the user's primary email
address, and a message will be logged to the debug log file.
HTML text handling revised
==========================
The handling for all non-plain text content has been revised in GetMessage. This
should improve the rendering of the emails on the devices
Reverted text/html encoding to base64
=====================================
A previous release had included a change to use quoted-printable encoding for
text/html content of generated emails. This has been reversed, and base64 will
instead be used, as the majority of incoming messages use base64
Added check for 'profile' tags in XML files
===========================================
A check for 'profile' tags in XML files has been added to fix a debug log error
Added quotes around 'rtf'
=========================
Quotes were added around rtf for class_exists checks to fix debug log error
ExtractSessionId and Empty Response
===================================
A check has been added for empty $response content in ExtractSessionID to fix a
debug log error
Changes specifically for as12.1 branch
======================================
Date range handling has been added to the Out-Of-Office logic in getSettings and
setSettings, and a small fix was added for $oofstate logic. as12.1 only.
Some function arguments needed to be changed to work with as12.1 branch - Fetch,
GetMessage & SendMail have all been updated
The handling of Follow-Up flags was changed to work with as12.1 branch
The classes ExportChangesZimbra and ImportHierarchyChangesZimbra were removed as
they are not needed for as12.1
IF YOU ARE UPGRADING FROM RELEASE 48 OR EARLIER - IT IS CRITICAL THAT YOU READ THE
RELEASE NOTES FOR RELEASES 49 & 50. SOME MAJOR CHANGES WERE IMPLEMENTED IN THOSE
RELEASES (ROLLED UP INTO RELEASE 51 ALSO) THAT WILL AFFECT YOUR SETUP
==================================================================================
Changes Made To Revision 50:
- Removed use of Mail_MimeDecode for synching emails out to the device, and
for getting details of the original email for Smart Forward/Reply as it
was found to be consuming huge chunks of memory whenever an email had large
attachments. This could cause the sync to crash. It would continue to
crash every time the phone tried to sync the mail folder until such time
as the message was moved on the server, or was outside of the window for
days to sync. Replaced functionality with native zimbra soap calls.
Mail_MimeDecode is still needed for SendMail from the phone to handle the
raw rfc822 data sent to zimbra - hopefully people will not be sending
huge attachments from their phones but, even if the send does fail, it
will not affect the sync of emails out to the phone.
- Fixed filtering Calendar/Contacts/Task folders when virtual is set to false
for a folder type and SmartFolders is enabled
- Removed function FromHeaderFix - as it is not used
- Removed function GetAttachmentBody - as it is not used
- Removed function GetBody - as it is not used
- Changed text/html encoding from base64 to quoted-printable for mime body
as it generally produced smaller output
- Added check for 'profile' in XML file to fix debug log error
- Added quotes around rtf for class_exists checks to fix debug log error
- Added check for empty $response content in ExtractSessionID to fix debug
log error
- Added Date range handling to Out-Of-Office logic in getSettings and
setSettings, and fixed $oofstate logic.
- Changed function arguments to work with as12.1 branch - Fetch, GetMessage,
SendMail
- Changed handling of flags to work with as12.1 branch
- Removed class class ExportChangesZimbra as not needed for as12.1
- Removed class class ImportHierarchyChangesZimbra as not needed for as12.1
Changes Made To Revision 49:
- HTML email when used with a patched install of the as12 branch of z-push
from the z-push SVN repository. I will document the installation process
separately in the near future. It has been tested with Android 2.3 and
Windows Mobile 6.5 to date. I have no access to Apple devices so cannot
do any testing on those - so they may still need some work.
The remainder fo the changes below apply to installations under either an
official z-push 1.5.x release, or the patched as12 release.
- Added new options to the config file to allow disabling of any folder
type system-wide. See details in notes at top of zimbra.php file
- Added new SmartFolders feature - to allow users to control the list of
folders they wish to sync to their devices without using XML files
NOTE: If you wish to enable SmartFolders - you MUST stop sync and clear
all old state data from the state folder. Even if no SmartFolder names
are used, the sequence and naming of the folders will change
NOTE: If SmartFolders are enabled, XML files will not be processed
To enable the feature set ZIMBRA_SMART_FOLDERS to true in config.php
Once enabled, the final character in a folders name can take on special
meanings as follows :-
"-" Do not include this folder or any subfolders thereof
"." Include this folder - But do not include any subfolders thereof
- Changed Attachments handling to allow attachments in multi-part messages
to be returned. Also allows attaching of an email as a .eml file
- Added ability to filter out Completed Tasks during sync - Note: As zimbra
does not store a Completed Date, the last modified timestamp is used
- Added Reminders for Tasks (for zimbra 7.0+) - need a zcs 6.0.nn user to test
if it will work on zcs 6.0.nn also
- Enhancement in SendMail to include original message text for reply/forward
This is done in preference to attaching the original as Android devices are
unable to open .eml attachments natively at this time
- Added check in SendMail for z-push version to ensure we properly format the
path to the "state" directory - change is to match the config.php change to
the definition of STATE_DIR introduced by z-push 1.5
- Fix in SendMail to honour ZIMBRA_ENFORCE_VALID_EMAIL when set to true. If
the from email address used is not a valid one for the account it is
replaced by the default sender email address.
- Fix in SendMail to add sender name to the address in all cases. This is a
generalized fix based on the original premise of the ZIMBRA_NOKIA_MFE_FIX
as it seems that iPhone and Android also send emails without a sender name
- Fixed GetSearchResults to match response 'keys' to latest zpushdefs.php
- Fixed possible memory leaks and reduced memory usage by unset()ing rtf and
mime decoder class instances, and various arrays
- Removed the input parameter from the params array send to Mail_mimeDecode
as it is already passed to the class on creation, and created and unset a
params object to ensure that memory is cleaned up
- Fix for special characters (",&,<,>) in user passwords
- Added fix for Euro symbol & other non-standard cp1252 characters
- Changes made to MoveMessage to prevent items being moved from one account to
another, and from one folder type to another. These restrictions are to
prevent items becoming inaccessible on the device. See comments in function
for more information.
- Removed username from Sync Request log entry for z-push 1.5 and later as
the z-push engine is already logging it
- Fix for Categories field from HTC Desire (Android 2.2) - Phone sends an
empty string Categories field instead of an array. The blank field caused an
error in CreateTagRequest. Fix to check that (is_array(input->categories))
- Fix added for iPhone/iPad/etc Meeting Request/Response handling as it appears
that the Apple client sends off meeting requests/responses directly from the
handset instead of letting the server handle them
- Fix in PROVISIONING getPolicyKey to avoid writing "validate" records in
database for android devices
- Fix in PROVISIONING generatePolicyKey to limit upper bound on random number
generator to 2147483647 (as some phones cannot handle larger numbers)
- Added function ReportMemoryUsage (called on Logoff) to track memory use
- Added new functions that are needed for ActiveSync protocol version 12
- ImportMessageFlag - use of this required a change to request.php
- GetSettings - used for Out-Of-Office
- SetSettings - used for Out-Of-Office, and storing Handset data
- Updated GetSearchResults to add mailbox search capability
PLEASE READ THESE RELEASE NOTES COMPLETELY BEFORE IMPLEMENTING RELEASE 50
THIS IS EXPECIALLY CRITICAL IF YOU ARE TURNING ON ANY OF THE NEW FEATURES
Minimise use of Mail_MimeDecode - to avoid running out of memory
================================================================
Shortly after publishing Release 49 an issue was discovered when handling an
email with a 13MB attachment. The loading of the email, and processign it with
Mail_MimeDecode resulted in the session running out of memory. The session
crashed, and reported a memory allocation error in the Apache log file.
Prior to release 49, this function was only used once in the application - at
the point where the user is sending an email from the phone. It is used to
process the raw uploaded file to prepare it for zimbra to send.
Release 49 introduced it's use to other places, synching emails out to the
device, and for getting details of the original email for Smart Forward/Reply.
It was in these places where it was found to be consuming huge chunks of
memory whenever an email had large attachments. This could cause the sync to
crash. It would continue to crash every time the phone tried to sync the mail
folder until such time as the message was moved on the server, or was outside
of the window for days to sync.
Release 50 has replaced the functionality for which this function was used
with native zimbra soap calls.
Mail_MimeDecode is still needed for SendMail from the phone to handle the raw
rfc822 data sent to zimbra as it was in releases prior to 48 - hopefully
people will not be sending huge attachments from their phones but, even if
the send does fail, it will not affect the sync of emails out to the phone.
Fixed filtering Calendar/Contacts/Task virtual folders
======================================================
When ZIMBRA_VIRTUAL_<Folder type> is set to false for a folder type with
SmartFolders enabled, the folder list was not being filtered correctly. This
has been fixed, and should now be working as expected.
System-wide Disable Switches for Folder Types
=============================================
Several users have asked over time if it is possible to turn off Email sync or
Calendar sync for an entire installation. Up to now it has only been possible
through a hack to force all users to read a particular XML file.
This release makes it possible to turn off individual folder types through the
config file. Enabling any of these switches will turn off that folder type (for
example email) for every user of the system. It will prevent all users from
syncing their email to their mobile devices.
The default setting remains that these switches are either not present - or are
set to false - in which case all folder types will be available for synching.
=== To Disable Sync of any Folder Type System-wide ===
Add the appropriate definition from this block to config.php, and set it true
NOTE: Devices will need a full-resync to remove the unwanted content
define('ZIMBRA_DISABLE_MESSAGES',true);
define('ZIMBRA_DISABLE_CONTACTS',true);
define('ZIMBRA_DISABLE_APPOINTMENTS',true);
define('ZIMBRA_DISABLE_TASKS',true);
SmartFolders
============
WARNING TO SYSTEM ADMINISTRATORS. IF YOU WISH TO ENABLE SMART FOLDERS YOU MUST STOP
SYNC FOR ALL DEVICES, CLEAR OUT THE STATE DIRECTORY, AND THEN RESYNC ALL DEVICES
THIS IS DUE TO AN OVERHAUL IN THE NAMING AND SEQUENCING OF FOLDER IDs
For many releases now, there has been the ability to manipulate the number and types
of folders that could be synced for an individual user through the use of user.XML
configuration files. While this worked well, it meant that the system administrator
had to be involved in every change for every user.
This release introduces a new feature called SmartFolders as an alternative to XML
files that will hopefully make it easy for users who wish to manipulate their syncing
content to be able to do the job themselves.
Note that SmartFolders and XML files are mutually exclusive on the server. Enabling
SmartFolders disables the use of user.XML files for everyone.
To enable the feature set ZIMBRA_SMART_FOLDERS to true in config.php
Once enabled, the final character in a folders name can take on special meanings as
follows :-
"-" Do not include this folder or any subfolders thereof
"." Include this folder - But do not include any subfolders thereof
So for example you might have a top level folder called "Archive-" into which you
move all old folders that you do not want to be able to see from your device.
Or you might have a "ToBeFiled." folder that contains a number of child folders used
for longer term storage of reference emails. Naming it with a period (.) on the end
will allow you to see that folder on your phone - so you can move emails in there to
clear your Inbox - and then when you get to your desktop you can file all the emails
into the appropriate child folders.
The SmartFolders feature is particularly useful on Android devices - which list out
every folder from your server across the top of the email client.
=== To enable the Smart Folders feature ===
NOTE: Enabling SmartFolders will DISABLE user.XML processing
It will also rename/resequence folder ID's in the state file for
the device - so state directory must be cleared prior to it's use
define('ZIMBRA_SMART_FOLDERS',true);
User control of Folder types
----------------------------
NOTE: z-push does not do hierarchy resync properly at this time - so if a user wishes
to make changes to their sync rules using the following directives, they should first
remove the sync account from their phone - then make the changes - then re-add the
account to their phone.
When SmartFolders are configured, in instances where individual users wish to disable
particular folder types from syncing to their devices, a special top-level folder
structure can be used to configure those options. This provides the major filtering
capability that would have been available through user.XML files.
If a folder named '*SyncConfig*' is found, the system will use any child folders in
that folder to configure options.
The names of the sub-folders will be interpreted as configuration directives.
These should have the format of
<folder type>&<setting=value>[&<setting=value>& ...]
<folder type> can be any one of message, contact, appointment, task and
<setting=value> can be any one of
active=true/false - active=false will disable sync of that folder type
virtual=true/false - virtual=false will turn of sync of additional folders (not
applicable for message type)
primary=FolderName - setting primary will override the default primary folder for
that content type (Inbox, Contacts, Calendar, Tasks)
So, for example, you could have
*SyncConfig*
message&active=false to disable email sync
task&active=true&virtual=false to limit the task sync to the primary folder
appointment&active=true&virtual=false&primary=WorkCalendar to limit
appointment sync to the WorkCalendar folder
The *SuncConfig* folder, and it's contents will never be synced to the phone so
long as ZIMBRA_SMART_FOLDERS is set to true.
Improvements in Attachment Handling
===================================
Attachments handling has been completely re-written to allow attachments in multi-part
messages to be returned. This restructuring also has an added benefit in that it
allows attaching of an email as a .eml file to another email.
Note: Android is currently unable to open attached email messages - but other clients
should be able to do so.
Improvements in Task Sync
=========================
Added ability to filter out Completed Tasks during sync - Note: As zimbra does not
store a Completed Date, the last modified timestamp is used
Added Reminders for Tasks (for zimbra 7.0+) - I no longer have a zcs 6.0.nn install
so if someone running version 6 can uncomment the 7.0 restriction and test it would
be very much appreciated.
Improvements in SendMail
========================
The entire SendMail function has been re-written to decompose the mime message
received from the phone, and to recompose it prior to sending. This allows for
easy fixing of the from address, as well as implementing SmartForward and
SmartReply (where the phone does not send the original content with the reply/
forward text)
The major enhancement in SendMail is to include original message text for reply/
forwarded emails. This is done in preference to attaching the original as Android
devices are unable to open .eml attachments natively at this time. In a future
release I may look to make this optional - or to follow the configuration in the
users Web client preferences
Added check in SendMail for z-push version to ensure we properly format the path
to the "state" directory - change is to match the config.php change to the
definition of STATE_DIR introduced by z-push 1.5 - The emails to be send are first
uploaded to the state directory, and then send from there by zimbra.
Fix in SendMail to honour ZIMBRA_ENFORCE_VALID_EMAIL when set to true. If the
from email address used is not a valid one for the account it is replaced by the
default sender email address.
Fix in SendMail to add sender name to the address in all cases. This is a
generalized fix based on the original premise of the ZIMBRA_NOKIA_MFE_FIX as it
seems that iPhone and Android also send emails without a sender name
Search should now return proper results
=======================================
Fixed GetSearchResults to match response 'keys' to latest zpushdefs.php
Company searches should now return lists of users as expected.
Improvements in Memory Management
=================================
Fixed possible memory leaks and reduced memory usage by unset()ing rtf and mime
decoder class instances, and various arrays
Note: even with these improvements, the memory footprint of an individual session
has increased slightly as a result of all the new functionality
Removed the input parameter from the params array sent to Mail_mimeDecode as it
is already passed to the class on creation, and created and unset a params object
to ensure that memory is cleaned up
Fix for Special Characters in Passwords
=======================================
Fix for special characters (",&,<,>) in user passwords. These characters should
no longer prevent users from synching.
Fix for Euro Symbol and Other cp1252 Characters
===============================================
Added fix for Euro symbol & other non-standard cp1252 characters that are not
represented in UTF-8
Restricted MoveMessage to single accounts/folder types
======================================================
Changes made to MoveMessage to prevent items being moved from one account to
another, and from one folder type to another. These restrictions are to
prevent items becoming inaccessible on the device.
It seems that when you move a message from a folder shared with you into one of
your own folders, ór vide-versa, zimbra assigns it a completely new message id.
However, there is no way to retrive what that new message id is through the SOAP
call. Therefore we ended up with a message now in the receiving folder that the
phone thinks still has it's original id from the originating folder. However, on
the server the id has changed. The item id on the phone therefore does not exist
on the server - and as a result cannot be moved/deleted/manipulated on the phone.
It will just sit there until the sync window (3 days for example) causes it to
drop out of the phone.
To avoid this situation - the phone is now prevented from moving items from one
users folder to another user's folder. Any attempt to move an item in this way
will return an error to the phone, and will log a message to the debug.txt file.
Tidied up SyncRequest log entries
=================================
Removed username from Sync Request log entry for z-push 1.5 and later as the
z-push engine is already logging it
HTC Android - Categories Fix
============================
Implemented a fix for Categories field from HTC Desire (Android 2.2)
In the case where a modified item on the phone, has no categories associated
with it, the phone sends an empty string in the Categories field. This is unexpected
in two ways. Firstly, most phones simply omit the field as it is optional. Secondly,
it sends a string variable instead of an array of string variables. The blank
field caused an error in CreateTagRequest.
The fix is to check that (is_array(input->categories)) prior to calling the
CategoriesToTags function.
Apple iPhone/iPad Meeting Request/Response Fix
==============================================
Note: As I do not own or have access to any Apple devices, I have been limited to
third party testing on this. It may still need more work.
A fix has been added for iPhone/iPad/etc Meeting Request/Response handling as it
appears that the Apple client sends off meeting requests/responses directly from the
handset instead of letting the server handle them. This was resulting in duplicated
emails going to and from the attendees and meeting organizer.
Hopefully the behaviour will be much better with these changes.
Improvements in PROVISIONING handling
=====================================
Fix in PROVISIONING getPolicyKey to avoid writing "validate" records in
database for android devices
Fix in PROVISIONING generatePolicyKey to limit upper bound on random number
generator to 2147483647 (as some phones cannot handle larger numbers)
Added Memory Use Reporting Function
===================================
Added function ReportMemoryUsage (called on Logoff) to track memory use
Added new Functions needed for ActiveSync 12 protocol
=====================================================
Added new functions that are needed for ActiveSync protocol version 12
- ImportMessageFlag - use of this required a change to request.php
- GetSettings - used for Out-Of-Office
- SetSettings - used for Out-Of-Office, and storing Handset data
- Updated GetSearchResults to add mailbox search capability
============== Z-Push Zimbra Backend - Release Notes - Revision 50 ==============
======================== CHANGES MADE IN EARLIER RELEASES ========================
Changes Made To Revision 48:
- Critical fix for v5 compatability fix. LookupV5Timezone missing the
$this-> pointer, so calls to the function caused crash in backend.
- Fix typo in name of v5timezone.xml file
- Added more error handling/logging around zimbra 5 compatability code, and
updated the v5 compatability notes
- Change to ExtractSessionID to return session for zimbra 5
- Change AlterPing to always return false for zimbra 5 as i4ms flag used by
AlterPingChanges does not exist on zimbra 5. Old folder ping method must
be used
- Fix in GetZimbraFolders to check for a folder identifier (l) before adding
the folder to the folder list. This is to avoid including any folders from
the notify block in the soap response
- Moved setting of _wasteID out of GetFolder and into Setup as GetFolder is
only called on a Hierarchy Sync - not on every sync - so it ended up being
set to false more often than not
- Fix in GetMessage to not create another meeting request out of a meeting
acceptance email
- Fix in CreateMeetingRequest to add invitees to the meeting if they are
provided, and to send out meeting invitations to the email addresses
specified (Android sends them - Nokia/WM don't - Not sure about iPhone)
- In function GetBody added html_entity_decode and preg_replace for duplicate
blank lines to make plain text output more readable when there is no
text/plain body part in the message
- Moved PROVISIONING: getDeviceRWStatus log message so it only logs for
unrecognised devices or those that have had a device wipe requested
- Added option to define ZIMBRA_DEBUG as 'user1' or 'user1,user2,userN' to
enable zimbra soap debug messages for just the listed accounts. Defining
it as true/false will continue to work as before
Changes Made To Revision 47:
- Added NokiaFakeOut to allow Nokia E72 and some other models to Send emails
- Added compatability fix for zimbra 5 timezone handling (see notes below)
- Changed ConvertItemIdToInvID to check for shared item IDs (i.e. look for a
":" in the passed $id) in case user modifies a shared appt on phone
- removed l= specified from ModifyAppointmentRequest to avoid moving a shared
appt to user's own Calendar when editing it on the phone
- Fix to avoid replacing the organizer name/email in ModifyAppointmentRequest
- Check for Organizer Name exists before outputting (to avoid error in log)
- Fix in GetBodyRecursive to use mb_detect_encoding() to identify the original
encoding of an email - prior to converting it to UTF-8 for the phone. To use
mb_detect_encoding, the PHP extension package php-mbstring must be installed
Changes Made To Revision 46:
- Added new functions TagsToCategories & CategoriesToTags to support syncing
Categories<->Tags on all content types
- Extended Categories<->Tags syncing to Appointments/Tasks (Note: z-push doesn't
support categories on Message sync in z-push 1.4)
- Fixed loop counter in Setup function to prevent recursion through all newly
added folders when checking for children of linked folders
- In StatMessage function for 'message' replaced call to GetMsgRequest with call
to GetMsgMetadataRequest to reduce data transfer and logging
- Improved sync of Birthday/Anniversary - Dates on zimbra must be in YYYY-MM-DD
format (or if --MM-DD format this/next year will be added depending on date)
- Fixed Children sync on Contacts by treating the value as an array instead of
a string. Uses implode/explode (Note: does not sync to Nokia Children field)
- Hard linked webpage sync on Contacts to workURL on zimbra as only one of the 3
workURL, homeURL and otherURL can be synced out to the phone, and once sync'ed
if a change is made to the contact on the phone, we would not know which of the
three URL fields to sync webpage to on an incoming contact
- Fix to avoid overflowing 32-bit integer for calExpandInstStart and
calExpandInstEnd when syncing calendar/tasks. Use strval() and append "000"
instead of multiplying by 1000
- Replaced divide by 1000 with substr() to avoid conversion issues in
Date4ActiveSync and GetMessage (appointment request email)
- Added new CONFIG.PHP key ZIMBRA_DEBUG to enable/disable logging of the SOAP
requests & responses, and the Setup Folder Lists. This allows more granular
debugging than using on the value of the WBXML.PHP key WBXML_DEBUG that turns on
Z-Push internal logging. It is now possible to log either on their own, or both
- Fix in GetMessage to avoid e_attribute_?? arrays to match names with email
addresses, as a blank value for a persons name would result in the incorrect
Personal name being matched with any subsequent email addresses
- Removed unused code and debug statements, and tidied up code
- Added DeviceType on new, and updated DeviceType and UserAgent on sync in
getDeviceRWStatus to show most recent client version that sync'ed
- Fixed reference to this_WasteID instead of $this->_wasteID
Changes Made To Revision 45:
- Implemented the provisioning "Remote Device Wipe" functionality. This needs a
MYSQL database to work. To disable it, set PROVISIONING to false in config.php
- Sync Device Categories with Server Tags (requirement for zimbra 7)
- Removed html="1" from GetMsgRequest calls in StatMessage to reduce data returned
- Fixed getBody to compare on passed $html variable instead of $this->_useHTML
- Added comments & Reduced logging in AlterPingChanges
Changes Made To Revision 44:
- Fixed parameters on iconv call added by Release 43 to handle foreign languages
Changes Made To Revision 43:
- Implemented the new AlterPing/AlterPingChanges method from 1.4 to reduce the
number of hits on the backend for monitored folders. Operates on the basis of
monitoring the i4ms flag on folders for changes
- Added handling of RTF field in appointment/task/contact where no Body/Notes
field received. Requires z_RTF.php include file from as12 branch of z-push SVN
to decode the Compressed RTF stream. Issue reported by Danish language user
- Removed multiple classes/functions that were duplicates of those in diffbackend
to simplify the updating of the code to match future z-push releases. We should
only declare "standard" classes/functions where we have a need to override.
- Changed debug logging of Soap Request/Response to follow WBXML.PHP debug flag
so that basic application flow debugging will not flood logs
- Changed date selection criteria for Appointments/Tasks to use the attributes
calExpandInstStart and calExpandInstEnd where Start is determined by cutoffdate
or defaulted to 366 days in the past and End is arbitrarily set to 366 days in
the future
- Fixed some issues with recurring appointments on last day or named day of month
Outgoing appointments would set WeekOfMonth to -1 when ActiveSync wants a value 5
Incoming appointments would set bysetpos to 5 where zimbra wants a value -1
- Changed default for all folder types to recursive=true - XML will still override
Changes Made To Revision 42:
- Fixed typo in $this->_virtualAddressbook missing an "s" on end
- Added isset checking to clean up "undefined index" entries in debug log
Changes Made To Revision 41:
- Fixed Bug With SendAsEmail and SendAsName
Changes Made To Revision 40:
- Added 'function_exists' Check for Timezone Functions
- Fixed Some Profile Parsing Issues
- Fixed Bug Where '&' in Subject or Body of Appointment Would Cause it Not to Sync
Changes Made To Revision 39:
- Removed PHP-SOAP From Requirements
- Added Error Checking For PHP-CURL
- Changed Tag For Search Folders In User File
- Meeting Organizer Name & Email Uses SendAsName and SendAsEmail From User File. If Not Specified, Get From Zimbra
- Added Config File Option (ZIMBRA_ENFORCE_VALID_EMAIL) To Prevent User (True) From Using Email Address (SendAsEmail) Not Owned By Them
Changes Made To Revision 38:
- Search Folder Support Added For Mail
- Fixed Bug In Profile Loading
- Fixed Bug That Was Not Handling The Absense Of The "Optional" AllDayEvent Flag From The Phone (Palm Pre Issue)
- Fixed Bug In AllDay Appointments Timezone
- Fixed Bug Where Multi-Day AllDay Server Appointment Appearing As Single Day On Phone
- Fixed Bug In Generating Timezone Blob From Zimbra Appointment That Caused Recurring Appointments To Move
- Fixed Meeting Request Emails So They Request Response (Accept/Decline/Tentative)
- Implemented MeetingResponse To Handle Meeting Requests (Requires Z-Push 1.4 Or Later)
- Refactored To Use $tzObject To Identify Every Instance Of A Timezone Identifier For Converting To/From ActiveSync
(Excessive Use Of $tz Was Getting Confusing)
- Removed Some Nokia Specific Code That Is No Longer Needed Now Timezones Are Working Better
Changes Made To Revision 37:
- NOTE TAG CHANGES TO USER PREFERENCE FILES
- Added Ability For Multiple Profiles In User Preference File (See Below For Details)
- Fixed Timezone Handling For Calendar Appointments
- Added Ability To Specify Roaming Timezone (See Below For Details)
- Tasks Implemented - Note: Zimbra supports a limited set of the ActiveSync Task functionality
(eg. Date Completed/Reminders/Repetition/Categories are not supported)
Credits
=======
This php script makes use of mime.php and mimePart.php from the PEAR project