I installed a ticket support software (osTicket) to our web server. Everything went smoothly except the IMAP extension on our server was not enabled, so osTicket can't accept e-mail to turn into tickets. This functionality is one of the main reasons we went with osTicket. Unfortunately, the hosting company won't enable the IMAP extension on our web server so I have been forced to find another means of receiving e-mail and getting them into the system.

After a bit of research and trying to trick the system into accepting remote piping using mailhooks, I have found Zend\Mail and am confident it will do the trick; however, the documentation for Zend\Mail, specifically for reading and manipulating messages, is pretty thin and there are not many code examples for me to work with. What I really need is a one-to-one mapping of imap functions to Zend\Mail functions. Specifically, I need to find out how to do in Zend\Mail each of these imap functions:

  • imap_timeout

  • imap_ping

  • imap_open

  • imap_close

  • imap_headers

  • imap_list

  • imap_utf7_decode

  • imap_createmailbox

  • imap_8bit

  • imap_binary

  • imap_base64

  • imap_qprint

  • imap_utf7_encode

  • imap_mime_header_decode

  • imap_utf8

  • imap_last_error

  • imap_headerinfo

  • imap_fetchstructure

  • imap_fetchbody

  • imap_fetchheader

  • imap_num_msg

  • imap_setflag_full

  • imap_uid

  • imap_mail_move

  • imap_delete

  • imap_expunge

I think I figured some of these out, but would appreciate another opinion. Is there a reference somewhere that shows the equivalents of these IMAP functions in Zend\Mail?

    Thread moved to Coding forum since it appears to have no relation to Zend Studio.

    EDIT:

    mittra;11037267 wrote:

    What I really need is a one-to-one mapping of imap functions to Zend\Mail functions.

    It seems like you're basing this on the assumption such a mapping even exists. While I'm not 100% familiar with both avenues, I'm going out on a limb and suggest such a mapping does not exist.

    It would seem (to me, at least) to be a much wiser idea to approach it from a functional standpoint. Don't try to develop some find-and-replace list to blindly convert imap() functions into a Zend\Mail equivalent; instead, take a look at a piece of code written with the imap() functions, take one step back, and ask yourself "What is this code doing?" Once you can answer that question, go back to Zend\Mail and ask yourself "How does one actually do (whatever) with Zend\Mail?"

      Appreciate it, Brad. I agree that the approach you suggest would be better for both A) understanding the code and 😎 making my modifications more functional. In the end, I did exactly that and think I got it... mostly. I am still having issues with it (outlined here: Modifying osTicket to use Zend Mail instead of IMAP functions), so I was hoping someone may know of a one-to-one mapping of the functions I had been unable to find (I had originally posed that exact question on stackoverflow.com and received no responses which is why I ended up trying to decode it myself).

      My apologies for putting this post in the wrong place. I thought Zend Framework was something of a subset of the Zend Studio so people hanging out in the Zend Studio area might have an answer. No worries, as I've noted, I'm pretty green to php and Zend, so I'm open to direction that moves me in the right direction. 🙂

        a month later

        I'm like a dog with a bone...

        I've been working through my osTicket scripts and am replacing the IMAP C-Client functions with Zend\Mail functions. It's been arduous, but at least I've managed to get it to the point where it's not throwing 500 Internal Errors. 🙂

        I need the structure of imap_fetchstructure now. I know what php.net says it is, but their explanation is incomplete. Here's what php.net says imap_fetchstreucture returns:

        type: Primary body type
        encoding: Body transfer encoding
        ifsubtype: TRUE if there is a subtype string
        subtype: MIME subtype
        ifdescription: TRUE if there is a description string
        description: Content description string
        ifid: TRUE if there is an identification string
        id: Identification string
        lines: Number of lines
        bytes: Number of bytes
        ifdisposition: TRUE if there is a disposition string
        disposition: Disposition string
        ifdparameters: TRUE if the dparameters array exists
        dparameters: An array of objects where each object has an "attribute" and a "value" property corresponding to the parameters on the Content-disposition MIME header.
        ifparameters: TRUE if the parameters array exists
        parameters: An array of objects where each object has an "attribute" and a "value" property.
        parts: An array of objects identical in structure to the top-level object, each of which corresponds to a MIME body part.

        I can reconstruct this using Zend\Mail... maybe create my own version of the function, but I need to know what's in the "dparameters" array, the "parameters" array, and the "parts" array.

        Anyone?

          Write a Reply...