Menu

#43 Working e-mail interface to 5dev37

open
nobody
Bug Fix (13)
5
2005-04-13
2005-04-13
No

This patchs makes the e-mail interface for 5dev37 fully functional. It's not perfect, but it works - creation and updating, even with attachments. (Probably all of this mail stuff should be rewritten/reorged since there a quite some duplicate stuff.)

I have even written som documentation.

Discussion

  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    If you don't have a patch program get "files.zip" from
    http://nordhaug.himolde.no/issue-tracker-patches/1182153/
    and unzip it in the Issue-Tracker directory. (Backing up first is always smart.)

     
  • Obert Jones

    Obert Jones - 2005-04-16

    Logged In: YES
    user_id=925643

    Hey Hans,

    Thanks for the patch which appears to function to a point on
    my installation. However, I've got two issues:

    1. Email sent from anonymous user returns a "Message
    rejected - no user exists with this e-mail address." email
    reply, even though I have the flag set on the Group to
    "Allow anonymous issues from email"

    2. Email sent or responded to from valid users does not
    update the Events, neither does it send out a Notification
    email.

    I have Debug turned on which spits out the error message in
    the 'DBI' file:
    "[Sat, 16 Apr 2005 17:40:14 -0400] query(SELECT variable
    FROM configuration WHERE variable='cached_data') called on
    bad SQL connection
    [Sat, 16 Apr 2005 17:40:14 -0400] Invalid database result
    passed to num_rows()

    Any ideas would be appreciated.

    -Ob

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    1) I didn't think about anonymous users. Until I make a real
    fix just remove the code between "# Attempt to authenticate
    the user" and "# If a group was given, make sure the group
    exists" in mailcheck.php. It should at least remove the
    rejection...

    2) The messages doesn't get rejected and no interesting info
    in log/parser? Have you turned on debugging in mailcheck.php
    - which just sends the output to stdout? I see the same
    errors in my logs/DBI, but updating events worked...

    I'll be away on a conference Monday and Tuesday, but
    Wednesday I'll look at this issue more - hopefully you have
    supplied some more info then related to 2)

     
  • Obert Jones

    Obert Jones - 2005-04-16

    Logged In: YES
    user_id=925643

    1) Commented out the check, now it functions as my second
    issue where it does not update the Events, neither does it
    send out a Notification email.

    2) Yes Debugging is turned on in mailcheck.php, and there
    are no errors on the output, the output
    starts with: "#!/usr/bin/php -q SERVER: <info about email> "
    ends with: "Sending message to Parser"

    No entries in Parser Rejects group either.

    Thanks.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    And in logs/parser? (I think you forgot to answer that
    question.) Anyway, I'll try to reproduce your problems on
    Wednesday.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, a wild guess - you are using IT on a Windows server? Try
    changing
    $handle = popen(dirname(__FILE__)."/parser", "w");
    to
    $handle = popen(dirname(__FILE__)."\parser", "w");
    in the end of mailcheck.php (around line 100). It shouldn't
    make a difference according to the manual for popen, but you
    never know...

    If logs/parser is empty or non-existing, this is probably
    the reason - and that was why I asked for it's contents.

     
  • Obert Jones

    Obert Jones - 2005-04-17

    Logged In: YES
    user_id=925643

    Good guess, but no, I'm actually on a Linux box (external ISP).

    The 'parser' script does exist and has the email logic in
    it. I places additional debug statements in the
    mailcheck.php file and all looks okay, even the path to the
    'parser' script is fine.

    I placed debug statements in the 'parser' script, and it
    apparently is not being executed, even though the
    permissions on the file are set correctly.

    -Ob

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, since the parser script isn't executed you probably have
    safe mode enabled which affects popen - read
    http://www.php.net/manual/en/function.popen.php
    Talk to your ISP to solve the problem.

     
  • Nobody/Anonymous

    Logged In: NO

    I checked with ISP as well as exec phpinfo() after the call
    to Parser, Safe_mode = off.

    Any other suggestions? I verified permissions on the files
    and parent folder--same results. it just dies when it calls
    'Parser'

    Thanks

    Obj

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, I have two more suggestions:
    1) To be absolutely sure that the problem isn't popen, test
    example 1 on http://www.php.net/manual/en/function.popen.php
    - just make a file with the three lines and open it in your
    web browser. It should list the files in the directory where
    you created the test file.
    2) If 1) is OK, the problem must be that your ISP hasn't
    installed php-cli - the command line version of PHP - but
    only enbaled PHP through the web browser. I think this might
    be the cause - let me know. (You could ask your ISP again.)

    mailcheck.php (and hence parser) should really be run from
    the command line or from cron, but I see that you are
    running it from your web browser - because you haven't shell
    access at your ISP maybe? I guess many people have this
    problem so I'll look into fixing this, i.e, making
    mailcheck.php call parser as an URL/through the web browser.

    Thanks for testing.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, example 1 isn't enough to get any output - use
    ----
    <?php
    $handle = popen("/bin/ls /bin", "r");
    echo "<pre>".fread($handle, 4096)."</pre>";
    pclose($handle);
    ?>
    ----
    in stead to test popen. (It will list (some of) the contents
    of the /bin directory.)

     
  • Nobody/Anonymous

    Logged In: NO

    The popen() of '/bin' worked fine and returned the contents
    of that folder to the browser.

    Thanks.

    -Obj

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, I made a new version of mailcheck.php and of parser - now called parser.php - that should work from the shell AND on the net (in a browser) - download
    http://nordhaug.himolde.no//issue-tracker-patches/1182153/test-2005-04-21.zip
    Please test - at least it worked flawlessly for me, in both situations.

    Regards,
    Hans

    PS! Check the setting of "_FILES_" in conf/const.php - it must be correct to get scripts to work in a browser.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    The URL broke in two - maybe it's easier to select the zip file from:
    http://nordhaug.himolde.no/issue-tracker-patches/1182153/

     
  • Nobody/Anonymous

    Logged In: NO

    Excellent fix Hans!! It worked like a charm!

    Having said that, you know you may have opened up a
    can-o-worms. Observations below:

    1. Awful amount of whitespace included in emails updated to
    the log. Looks like 7 to 10 lines on either side of email
    message.

    2. Retrieved email is not being deleted from server, so
    subsequent 'mailchecks' create duplicate events.

    3. A reply sent back to the tracking system includes the
    whole email (several events in the body). Is it possible to
    read and include the lines up to the first one containing
    "Issue xxxx"

    4. If the log is 'New' as opposed to 'Updated', can the
    reply message include verbiage similar to:
    "Your ticket has been submitted to our Support department,
    one of the staff members will review it and reply
    accordingly. Listed below are details of this ticket."

    5. Are you able to edit events, mine brings up a blank
    screen, I know this was resolved in v4.0.x.

    Excellent job on this fix, I know (although they are silent)
    many, many people were waiting for this!!

    P.S. I made a few modifications to your Debug output and
    replaced tabs and newlines with <br>, </br>

    -Obj

     
  • Obert Jones

    Obert Jones - 2005-04-21

    Logged In: YES
    user_id=925643

    Apologies for not being logged in, but the previous reply
    came from me. I guess I was a bit excited. hehehe!

    Excellent long awaited fix!!

    -Obj

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    I'm glad it worked. I'll clean up the files, i.e., move the
    files from test-2005-04-21.zip into files.zip, so that
    people can use the fix without reading all our messages.

    Because of the lack of response from the IT developer I'll
    move onto EnterTrack - I just wanted to make my patch usable
    before leaving.

    Some comments (to your points below):
    1) Whitespace is probably caused by this line in parser.php
    - you could try to remove it:
    ----
    // Ensure conforming (Unix) newlines in rawdata
    $message['rawdata'] = str_replace(array("\r\n", "\r"), "\n",
    $message['rawdata']);
    ----
    Maybe you don't need it for your server.
    2) Read mail not expunged: In
    includes/classes/mail.class.php on line 272 replace:
    return false;
    with
    return imap_delete($this->conn,$msgno);
    (I'll add it to the patch when updating.)
    3-4) It is doable, but as I said - I'm giving up IT.
    5) No, I can't edit events. (It's probably easy to fix, but
    see line above.)

    > P.S. I made a few modifications to your Debug output and
    > replaced tabs and newlines with <br>, </br>

    Well, that works fine in a browser, but not when run from a
    shell.
    I'll make the debug look good both for screen and browser.

    This is my last effort on this patch - I wish you good luck.
    I expect the clean up/updating of the files done today.

    Hans

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, all files are cleaned up (and fixes mentioned below are
    implemented). All files are now only stored on my site:
    http://nordhaug.himolde.no/issue-tracker-patches/1182153/
    The file EMAIL is the documentation. README should also be read.

    I'll NOT do any more work on this patch - continue the
    discussion in the forum. I'll ask filipg - who has made a
    lot of patches - to include the e-mail fix to his special
    version of IT5dev37 - ref
    http://repairfaq.ece.drexel.edu/filipg/issue-tracker/ -
    which I can recommend.

    Regards,
    Hans - who is moving on to EnterTrack.

     
  • Filip Gieszczykiewicz

    Logged In: YES
    user_id=37894

    Howdy. I merged in your patch (as well as parts of the other
    patch you posted for IT re: translation) but have not had a
    chance to test it even once yet! I have a new snapshot but
    it would be a crime for me to post that before I have a
    chance to see if it works. I never use the e-mail feature so
    I'll have to set it up first. Thanks, Fil.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    I finally understand what has happened - the "major typo"
    wasn't a typo after all, but even worse - it is the old
    version of mailcheck.php before I made the changes
    that made it work for obj13. I have contacted obj13 and
    will post here when I have updated files.zip with the new
    correct version of mailcheck.php.

     
  • Hans Fr. Nordhaug

    Logged In: YES
    user_id=21914

    OK, I got the correct mailcheck.php from obj13 - thanks - and
    have updated "files.zip". If you have downloaded the patch
    before
    you should do it again - go to:
    http://nordhaug.himolde.no/issue-tracker-patches/1182153/

    I repeat that I also added a check for IMAP support in PHP
    (which is needed to get e-mail to work).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.