6.0.0-git
2019-04-24

[#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 2011-07-04 (2851 days ago)
Due
Updated 2011-07-21 (2834 days ago)
Assigned 2011-07-05 (2850 days ago)
Resolved 2011-07-13 (2842 days ago)
Milestone
Patch No

History
2011-07-21 17:07:51 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 :)
2011-07-20 22:13:24 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.

2011-07-20 18:39:37 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
2011-07-20 18:39:14 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.
2011-07-20 18:36:37 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
2011-07-20 14:29:15 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.
2011-07-14 01:20:33 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
2011-07-13 20:20:25 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.
2011-07-13 20:19:50 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
2011-07-12 19:46:24 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 :\
2011-07-12 19:41:01 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? :)

2011-07-12 19:14:53 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).
2011-07-12 19:03:40 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 :\

2011-07-12 18:30:11 Michael Slusarz Comment #5 Reply to this comment
Can this be closed?
2011-07-05 11:05:41 Jan Schneider Comment #4 Reply to this comment
I assume you've been able to fix that too.
2011-07-05 08:39:32 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
2011-07-05 08:22:14 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Works fine here.
2011-07-04 16:01:28 rui (dot) carneiro (at) portugalmail (dot) net Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ Unable to get message content on pre_sent hook
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
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