Zimbra to PHP: Difference between revisions

No edit summary
No edit summary
Line 15: Line 15:
----
----


''Trick'' Getting the Message ID for testing.   
'''Trick''' Getting the Message ID for testing.   
Send your self a message with a few attachments, maybe a .pdf, .jgp, and .doc.
Send your self a message with a few attachments, maybe a .pdf, .jgp, and .doc.
Right click on the message (after in comes in your in box), and choose '''Show Original Message'''.
Right click on the message (after in comes in your in box), and choose '''Show Original Message'''.

Revision as of 16:38, 14 February 2007

If you need to move information from Zimbra into an external application there are several different ways of doing it. Please read the blog below and then pick back up on this article.

http://www.zimbra.com/blog/archives/roland_schemers/

This example starts with a Zimlet and ends with an external application.

Zimlet Behavior: Drag an email message on the zimlet, a popup box asks for additional information, then passes the all of the information via post to the external application, this may be a Wiki, SugarCRM, dotProject or other document management archiving program.

The information passed to the PHP application includes the message id and the number of parts (attachments or other). The external application can use curl to get other.

This example will should pull up an email message with embedded attachments. But we don't want the attachments this way. Lets let Zimbra do the work.



Trick Getting the Message ID for testing. Send your self a message with a few attachments, maybe a .pdf, .jgp, and .doc. Right click on the message (after in comes in your in box), and choose Show Original Message. At this point you will not be able to see the url of the page, so bookmark it. Go to your book mark and open it that way. Now you can see the url. Mine look like this, but with obvious modifications.



http://ZimbraMailServer.example.com/service/home/~/?auth=co&id=15260


This is how we can get the attachments, notice the url Get's. Add a new one &part=. My new url looks like.


http://ZimbraMailServer.example.com/service/home/~/?auth=co&id=15260&part=2


When &part=3, my browser tries to download something. Note: &part=, gets the message. Play around and see how it works.


This is why we need to extract the number of parts or attachments from our Zimlet, before we pass the information to php.


What if we want to get all attachments in a zip file. Wow, this is soo cool! Just add &fmt=zip and drop the part. This will give us the whole email as an attachment.


Now, I'm lazy and I don't want to have to parse this email message. I'm not going to use this method to extract from, to, cc, body. I'm going to let Zimbra do that for me in my zimlet. But I'm going to pass the message id and the number of parts.

PHP code coming soon.



---I may post a JSON example here soon---

Jump to: navigation, search