6.0.0-beta1
8/15/25

[#10306] Unable to get message content on pre_sent hook
Summary Unable to get message content on pre_sent hook
Queue IMP
Queue Version Git master
Type Bug
State Not A Bug
Priority 1. Low
Owners
Requester rui.carneiro (at) portugalmail (dot) net
Created 07/04/2011 (5156 days ago)
Due
Updated 07/21/2011 (5139 days ago)
Assigned 07/05/2011 (5155 days ago)
Resolved 07/13/2011 (5147 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/21/2011 05:07:51 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #18 Reply to this comment
Ahhh... you probably did not patch the Mime package with commit 
16d7d4e08bc47cc43f70958ad2c0faeca5cbbe40.  That is also needed.
Confirmed. Working since this commit.

Thank you Michael :)
07/20/2011 10:13:24 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #17 Reply to this comment
Ahhh... you probably did not patch the Mime package with commit 
16d7d4e08bc47cc43f70958ad2c0faeca5cbbe40.  That is also needed.
That patch looks good indeed. I am almost sure I always pull your code 
before testing a bug. Tomorrow I will recheck that.

07/20/2011 06:39:37 PM Git Commit Comment #16 Reply to this comment
Changes have been made in Git for this ticket:

Revert "Ticket #10306: Build MIME IDs when building message from contents"
This reverts commit a997228094366e783f8ce0f9dcdf963e2dda0c43.

  1 files changed, 1 insertions(+), 2 deletions(-)
http://git.horde.org/horde-git/-/commit/a4d7baf4cfaa663aa5635ef59171bb41beee7135
07/20/2011 06:39:14 PM Michael Slusarz Comment #15 Reply to this comment
I have no idea why this is happening.
I have no idea, because this doesn't happen for me - buldMimeIds() is 
internally called somewhere so this should not be an issue.

Ahhh... you probably did not patch the Mime package with commit 
16d7d4e08bc47cc43f70958ad2c0faeca5cbbe40.  That is also needed.

So I am going to revert what I just added - since it should not be 
needed and is unnecessary overhead.
07/20/2011 06:36:37 PM Git Commit Comment #14 Reply to this comment
Changes have been made in Git for this ticket:

Ticket #10306: Build MIME IDs when building message from contents

  1 files changed, 2 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/a997228094366e783f8ce0f9dcdf963e2dda0c43
07/20/2011 02:29:15 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #13
New Attachment: 0001-Build-mime-ids-before-using-IMP_Contents.patch Download
Reply to this comment
Added code to hooks.php to always grab the plaintext portion of the message.
I was testing this hook now but I am still unable to use it :\

After some debug I found the problem. The Horde_Mime_Part received on 
pre_sent hook do not have any mimeid set so the contentTypeMap method 
always returns the first part only (multipart/alternative).

I fixed this using $message->buildMimeIds() just before using IMP_Contents.

I have no idea why this is happening.
07/14/2011 01:20:33 AM rui (dot) carneiro (at) portugalmail (dot) net Comment #12 Reply to this comment
Added code to hooks.php to always grab the plaintext portion of the message.
Thank you Michael :D
07/13/2011 08:20:25 PM Michael Slusarz Comment #11
State ⇒ Not A Bug
Reply to this comment
Added code to hooks.php to always grab the plaintext portion of the message.
07/13/2011 08:19:50 PM Git Commit Comment #10 Reply to this comment
Changes have been made in Git for this ticket:

Ticket #10306: Correct way to search for compose message contents in 
HTML message

  1 files changed, 3 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/b0ba72085c12702e4eac6cb93496c01f90e5a407
07/12/2011 07:46:24 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #9 Reply to this comment
Can you update hooks.php.dist with an example of how to do it with 
text/html messages? Please? :)
*on how

Sorry my English :\
07/12/2011 07:41:01 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #8 Reply to this comment
Why are you using getContents()?  That only returns the text 
contained in the base part.  If sending text/html messages, this 
will always be empty (since it is a multipart/related part, which 
has not text of its own).
I was just trying to use the example provided. My knowledge of 
Mime_Part is not that much :X

Can you update hooks.php.dist with an example of how to do it with 
text/html messages? Please? :)

07/12/2011 07:14:53 PM Michael Slusarz Comment #7 Reply to this comment
Can this be closed?
Just pulled your latest code (horde code only) and I am still unable 
to use this hook.

$message->getContents() always return empty :\
Why are you using getContents()?  That only returns the text contained 
in the base part.  If sending text/html messages, this will always be 
empty (since it is a multipart/related part, which has not text of its 
own).
07/12/2011 07:03:40 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #6 Reply to this comment
Can this be closed?
Just pulled your latest code (horde code only) and I am still unable 
to use this hook.

$message->getContents() always return empty :\

07/12/2011 06:30:11 PM Michael Slusarz Comment #5 Reply to this comment
Can this be closed?
07/05/2011 11:05:41 AM Jan Schneider Comment #4 Reply to this comment
I assume you've been able to fix that too.
07/05/2011 08:39:32 AM rui (dot) carneiro (at) portugalmail (dot) net Comment #3 Reply to this comment
Works fine here.
Even with this syntax error? :P

https://github.com/horde/horde/blob/master/imp/config/hooks.php.dist#L208
07/05/2011 08:22:14 AM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Works fine here.
07/04/2011 04:01:28 PM rui (dot) carneiro (at) portugalmail (dot) net Comment #1
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Unable to get message content on pre_sent hook
Type ⇒ Bug
Queue ⇒ IMP
Reply to this comment
After debugging this hook a bit I found that getContents() is always 
returning an empty string.

I was using your Example #2 from hooks.php.dist

Saved Queries