I have finished rewriting the mailfetch script for osTicket that was dependent on imap c-client functions so it now uses Zen\Mail functions instead.

[ATTACH=CONFIG]5059[/ATTACH]

On the whole it works; however, I have a couple of issues:

  1. When it receives an email and turns it into a ticket, it sends two notification messages to the user that contain the subject line, but have no body content.

  2. I have my setting to move the email message after it have been read to a folder. Right now all it does is mark the message as read.The third option (options 1 & 2 being mark the message as read and move it to an archive folder) is to delete the original message. It is not doing this either.

I believe the segment responsible for the message handling (move, delete, do nothing) is ~lines 640 - 655 and the part for generating the notification email is part of "function createTicket" which starts ~line 523.

If there are other scripts or sections of code that you need to see to figure out what is happening, please let me know. Anything I touched in the script is heavily commented on to explain what was going on. You'll notice that the comments around the segments that are causing issues are sparse and that's because I made very few changes in those areas.

I have been staring at this stuff for months now. I would certainly appreciate a fresh set of eyes looking at it.

class.zmailfetch.txt
    8 days later

    I have fixed the second issue. It now moves/deletes the original email message as I have indicated in my settings.

    I have also determined that it is sending only one message, but appears to be populating the "To" twice..... still trying to work out where/why that happens. And it's not populating the message body with the autoresponse template text..... If I understand correctly, that occurs in another script entirely, but I'm guessing that my modified script is not passing something expected in the other script....

    I'm trying to figure out what that is and where it leaves this script. Here's the updated version of the mailfetch script: [ATTACH]5067[/ATTACH]

    This has to be happening in function createTicket(), but I get so confused by depndency injection and calling classes and functions across scripts that I'm confused as to where. The function createTicket starts at line 498.

    class.zmailfetch.txt

      I did some further digging and have resolved the issue by modifying one line.... I changed a few settings in my installation too, but I'm pretty sure the change to one of the scripts fixed the blank message thing. Not sure about the double message thing, but it's not sending dupes anymore. 🙂

        2 years later

        Hi mittra,

        i hope you are still active here, as maybe you can help me with the same issue you successfully solved: the "blank message thing". Can you tell me how you solved it?

        Thanks and bye

        HAL9001

          Hi HAL,

          I am not nearly as active as I once was, but I do get notifications about responses to my posts, so here I am! Based on the date of that last post that said I solved it, that was about two years ago and several versions of osTicket back. We also upgraded our hosting plan and we are now using osTicket "out of the box" without my modified scripts, so I don't know that I can tell you exactly what I did back then to get it working correctly. Perhaps you could tell me a little bit more about your installation and the steps you've taken to date that brought you to my post and the hope that I would have a solution?

          Mittra

          PS
          Have you seen Dave lately? 😉

            Write a Reply...