[#13160] Cannot send email with ActiveSync
Summary Cannot send email with ActiveSync
Queue Synchronization
Queue Version FRAMEWORK_5_2
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester asottile (at) gmail (dot) com
Created 2014-05-03 (1870 days ago)
Updated 2015-10-20 (1335 days ago)
Assigned 2015-10-12 (1343 days ago)
Resolved 2015-10-20 (1335 days ago)
Patch No

2015-10-20 14:11:39 Michael Rubinsky Comment #7
State ⇒ Resolved
Reply to this comment
Going to assume this is fixed. Please reopen if not.
2015-10-12 01:06:13 Michael Rubinsky Comment #6
State ⇒ Feedback
Reply to this comment
Can you see if this commit fixes the issue for you?
2015-10-12 01:05:14 Git Commit Comment #5 Reply to this comment
Changes have been made in Git (master):

commit 21be2052d40b6862c64c43c490450766227bce8a
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sun Oct 11 21:03:26 2015 -0400

     Bug: 13160. Avoid errors due to systems where php://input isn't seekable.

  .../lib/Horde/ActiveSync/Wbxml/Decoder.php         |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

2015-09-18 17:09:28 Michael Rubinsky Version ⇒ FRAMEWORK_5_2
Queue ⇒ Synchronization
2015-09-18 17:08:21 Michael Rubinsky Comment #4
State ⇒ Assigned
Reply to this comment
Ok. It looks like prior to PHP 5.6 the php://input stream may or may 
not be readable multiple times or seek-able depending on the SAPI in 
use. I'll take a closer look at this.

2015-09-18 16:11:22 alberic (at) depertat (dot) net Comment #3 Reply to this comment

I have exactly the same problem. When trying to send from an iPhone or 
an iPad (iOS 9), I get the following in the log (traceback edited for 
readability) :

Sep 18 16:03:36 groupware HORDE: PHP ERROR: rewind(): stream does not 
support seeking [pid 812 on line 502 of 
Sep 18 16:03:36 groupware HORDE:
1. Horde_Rpc_ActiveSync->getResponse() /var/www/horde/rpc.php:160#012
2. Horde_ActiveSync->handleRequest() 
3. Horde_ActiveSync_Request_Base->handle() 
4. Horde_ActiveSync_Request_SendMail->_handle() 
5. Horde_ActiveSync_Wbxml_Decoder->getFullInputStream() 
6. Horde_Stream->add() 
7. Horde_Stream->seek() /usr/share/php/Horde/Stream.php:141#012
8. Horde_Stream->rewind() /usr/share/php/Horde/Stream.php:521#012
9. rewind() /usr/share/php/Horde/Stream.php:502#01210. 
Sep 18 16:03:37 groupware HORDE: [turba] PHP ERROR: Declaration of 
Turba_Driver_Vbook::_add() should be compatible with 
Turba_Driver::_add(array $attributes, array $blob_fields = Array, 
array $date_fields = Array) [pid 15438 on line 0 of 

Not sure the last line is relevant, but here it is anyway. Everything 
is at the current last version, that is :
- Horde Groupware Webmail Edition 5.2.10
- Horde (horde) 5.2.7
- Courrier (imp) 6.2.10
- Horde_ActiveSync 2.29.1
-  Horde_Stream 1.6.2

One thing I can tell is that it used to work in past versions of both 
Horde and iOS, but I can't recall when as I don't use this very often.

Thanks for your time
2014-05-15 16:34:20 Michael Rubinsky State ⇒ No Feedback
2014-05-09 16:20:11 Michael Rubinsky Comment #2
State ⇒ Feedback
Reply to this comment

[Show Quoted Text - 44 lines]
Not sure where that is coming from. In FRAMEWORK_5_1 we check for the 
presence of the From header and only add a new header if it's not 
found. See Horde_Core_ActiveSync_Driver::sendMail().  In master (which 
currently contains Horde 5.2 code) we actually always remove the From 
header and add a new one see the same method as above.

I can verify that sending email from an EAS client works perfectly 
fine here. Check your mail server logs to see why the message was 
rejected (or if the message was ever seen by the smtp server at all).

[Show Quoted Text - 9 lines]
This is inside the Horde::debug() method, which wouldn't be something 
added by us. It's only used during debugging.
May  3 00:59:10 localhost HORDE: [horde] PHP ERROR: fseek(): stream 
does not support seeking [pid 15385 on line 556 of 
Probably related to above.

2014-05-06 10:07:07 Jan Schneider Assigned to Michael Rubinsky
State ⇒ Assigned
2014-05-03 01:17:13 asottile (at) gmail (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ Cannot send email with ActiveSync
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
I am using Horde with an IMAP backend to provide EAS support for an 
existing IMAP+SMTP server. Reading and sending messages work fine from 
the webmail. I can also read messages perfectly from a mobile device. 
Push notifications work too. Unfortunately, sending emails is 
impossible. Sent messages are correctly saved in the sent folder, but 
they are not delivered.

Inspecting the source code of the messages in the sent folder reveals 
errors in the structure of the message. Attached below there is one of 
this messages that are not sent by the SMTP server.

From: sender@server.com
Subject: Test
Message-Id: <5A958E86-0877-40AC-A78F-7018C9D212BF@gmail.com>
Date: Sat, 3 May 2014 02:48:18 +0200
To: Alberto <receiver@gmail.com>
User-Agent: Horde Application Framework 5
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
From: sender@server.com
Mime-Version: 1.0 (1.0)
Subject: Test
Message-Id: <5A958E86-0877-40AC-A78F-7018C9D212BF@gmail.com>
Date: Sat, 3 May 2014 02:48:18 +0200
To: Alberto <receiver@gmail.com>



I believe that the presence of two Form: fields interferes with the 
message sending procedure from the SMTP server. I have no idea why the 
message is structured in this way by the ActiveSync wrapper. Messages 
sent from webmail are fine.

Inspecting the horde logs reveals two php errors with fseek() that 
occur whenever I send a message from the mobile device. I do not know 
if they are related with this issue or not.

May  3 00:59:10 localhost HORDE: [horde] PHP ERROR: rewind(): stream 
does not support seeking [pid 15385 on line 124 of 
May  3 00:59:10 localhost HORDE: [horde] PHP ERROR: fseek(): stream 
does not support seeking [pid 15385 on line 556 of 


Software versions:
Horde Groupware 5.1.4
ActiveSync EAS 12.1 (but this also happens with 12.0, 14.0 and 14.1)
iOS 7.1.1


Saved Queries