Hastymail2

Hastymail2 is an Open Source IMAP webmail client written in PHP. Our focus is compliance, usability, security, and speed.

Hastymail 2

avatar
RC8 Questions/Problems
I recently upgraded to the latest RC and noticed a few things:
  • If I have lots of unread emails (lets say anything over 5K), which can happen with me occasionally since I have mostly scripts that email me, opening an email takes up to 60 seconds and kills the server.  I found patching like this in message.php fixed (obviously not a real fix - but it works for me):

                        if ($total_unread) {
                            $user->page_data['unseen_uids'][] = $user->page_data['message_uid'];
                            //$user->page_data['unseen_uids'] = $this->sort_uid_list($user->page_data['unseen_uids'], $mailbox);
                        }
  • If you click "Stop tracking unread mail in this folder", PHP will output things NOTICE errors if configured to do so in PHP error handling when you log back in
  • Would be very cool if a "Forward" (or perhaps call it "Attach") was added to the list of top folder view buttons (i.e. Filter, Delete, Read, Unread, etc.) whereby it would compose a new email with the selected emails as attachments (i.e. feature from squirrelmail).
  • Search "On this page" does not seem to work.  It would be cool to have a default_top_page_search option like the default_top_page_links option (option to show the quick search at the top of the page as well).
  • How do filters work?  I assumed this would be like a saved search or something along those lines (which would be cool!), but I am just not understanding the implementation in HM.
  • I noticed that attachment downloads do not work on the Android browser in hastymail (at least for me).  Possibly due to bad handling of the content-disposition header by the android browser - just letting you know even though it is probably not on your end.

Thanks for any comments/help/etc.

Michael

Reply /Quote
avatar
RC8 Questions/Problems
Also noticed when importing a multi-contact VCF file created by gmail/google, I get this error: Notice: unserialize() [function.unserialize]: Error at offset 65536 of 65535 bytes in /<path_to_hastymail>/lib/vcard.php on line 190
Reply /Quote
avatar
Re: RC8 Questions/Problems
  • If I have lots of unread emails (lets say anything over 5K), which can happen with me occasionally since I have mostly scripts that email me, opening an email takes up to 60 seconds and kills the server.  I found patching like this in message.php fixed (obviously not a real fix - but it works for me):

                        if ($total_unread) {
                            $user->page_data['unseen_uids'][] = $user->page_data['message_uid'];
                            //$user->page_data['unseen_uids'] = $this->sort_uid_list($user->page_data['unseen_uids'], $mailbox);
                        }
I can see how the sort method you are commenting out is the cause of the problem (when the amount of unread messages is large), however I am not yet sure of the best fix. By commenting out the sort method the "unread prev/next" links on the message view will not be in the same order as the sort order of the mailbox. I will do some more testing to determine a better sort method.
  • If you click "Stop tracking unread mail in this folder", PHP will output things NOTICE errors if configured to do so in PHP error handling when you log back in
I am not able to reproduce this. What version of PHP are you using? Does this occur no matter which folder you stop tracking mail with?
  • Would be very cool if a "Forward" (or perhaps call it "Attach") was added to the list of top folder view buttons (i.e. Filter, Delete, Read, Unread, etc.) whereby it would compose a new email with the selected emails as attachments (i.e. feature from squirrelmail).

I do like that feature in squirrelmail :) I will put it into the tracker and look into how hard it would be. We already support an "attach" link on the message view page so maybe it will not be difficult.

  • Search "On this page" does not seem to work.  It would be cool to have a default_top_page_search option like the default_top_page_links option (option to show the quick search at the top of the page as well).
Would not be too hard I don't think but might have to wait until after the first stable release. I will add this to the tracker as well.
  • How do filters work?  I assumed this would be like a saved search or something along those lines (which would be cool!), but I am just not understanding the implementation in HM.
The filters plugin is for sites that do not have a server side filtering mechanism. A filter rule consists of matching criteria and a corresponding action. The message controls on mailbox views have a "filter" button that will search for messages matching the filter rules and execute the resulting actions (filters rules also have an order: a message matching a filter at the top of the list will skip any rules after that also match). The plugin also supports auto-filtering the inbox whenever it is selected.
  • I noticed that attachment downloads do not work on the Android browser in hastymail (at least for me).  Possibly due to bad handling of the content-disposition header by the android browser - just letting you know even though it is probably not on your end.
Since RC8 a bug report was entered suggesting a few additional HTTP headers to be sent with downloaded attachments which I added to SVN. I was able to download an html message part using android on a motorola droid phone, though when I tried to download an RFC822 part my phone told me that the message type was unsupported.

Thanks for the feedback. I will update the tracker and this thread on these issues when I can.
Jason
Reply /Quote
avatar
Re: RC8 Questions/Problems

As already confirmed off list the problem here is the SQL in Hastymail2 that creates the contacts table for Mysql. We were using a text field type to store the serialized contacts array and this type is not large enough. SVN now uses a longtext field that solves this issue.

Thanks again for the feedback,
Jason

Reply /Quote
avatar
Re: RC8 Questions/Problems
  • Search "On this page" does not seem to work.  It would be cool to have a default_top_page_search option like the default_top_page_links option (option to show the quick search at the top of the page as well).

Sorry, forgot to mention that this works for me so I am not sure what is going wrong. Can you enable the show_imap_debug setting and send me the results after you do a search? (The debug shows below the interface in the browser). You can send it to jason@hastymail.org.

Thanks,
Jason

Reply /Quote
avatar
Re: RC8 Questions/Problems
sailfrog said:
  • If I have lots of unread emails (lets say anything over 5K), which can happen with me occasionally since I have mostly scripts that email me, opening an email takes up to 60 seconds and kills the server.  I found patching like this in message.php fixed (obviously not a real fix - but it works for me):

                        if ($total_unread) {
                            $user->page_data['unseen_uids'][] = $user->page_data['message_uid'];
                            //$user->page_data['unseen_uids'] = $this->sort_uid_list($user->page_data['unseen_uids'], $mailbox);
                        }
I can see how the sort method you are commenting out is the cause of the problem (when the amount of unread messages is large), however I am not yet sure of the best fix. By commenting out the sort method the "unread prev/next" links on the message view will not be in the same order as the sort order of the mailbox. I will do some more testing to determine a better sort method.

I attempted to fix this correctly instead - this seems to speed things up by an order of magnitude (in_array is slow) when you have lots of unread email (I am currently at 9496 unread):

function sort_uid_list($uids, $mailbox) {
    $res = array();
    if (isset($_SESSION['uid_cache'][$mailbox]['uids'])) {
        $uids = array_flip($uids);
        foreach ($_SESSION['uid_cache'][$mailbox]['uids'] as $i => $v) {
            //if (in_array($v, $uids)) {
            if (isset($uids[$v])) {
                $res[] = $v;
            }
            if (count($res) == count($uids)) {
                break;
            }
        }
    }
    else {
        $res = $uids;
    }
    return $res;
}

However, I don't fully understand the codes purpose so obviously this should be checked/tested - I am now running this for whatever it is worth.

  • If you click "Stop tracking unread mail in this folder", PHP will output things NOTICE errors if configured to do so in PHP error handling when you log back in
I am not able to reproduce this. What version of PHP are you using? Does this occur no matter which folder you stop tracking mail with?
  • Would be very cool if a "Forward" (or perhaps call it "Attach") was added to the list of top folder view buttons (i.e. Filter, Delete, Read, Unread, etc.) whereby it would compose a new email with the selected emails as attachments (i.e. feature from squirrelmail).
Hmm - now it is not doing it for me either.  Maybe this happened while I was tinkering with the code earlier.

I do like that feature in squirrelmail :) I will put it into the tracker and look into how hard it would be. We already support an "attach" link on the message view page so maybe it will not be difficult.

  • Search "On this page" does not seem to work.  It would be cool to have a default_top_page_search option like the default_top_page_links option (option to show the quick search at the top of the page as well).
Would not be too hard I don't think but might have to wait until after the first stable release. I will add this to the tracker as well.
Cool - if it is easy, I think it would be a worthwhile addition.  I know I would use it quite a bit.
  • How do filters work?  I assumed this would be like a saved search or something along those lines (which would be cool!), but I am just not understanding the implementation in HM.
The filters plugin is for sites that do not have a server side filtering mechanism. A filter rule consists of matching criteria and a corresponding action. The message controls on mailbox views have a "filter" button that will search for messages matching the filter rules and execute the resulting actions (filters rules also have an order: a message matching a filter at the top of the list will skip any rules after that also match). The plugin also supports auto-filtering the inbox whenever it is selected.
Thanks!  I finally found the "Manage Filters" link on the Options page so I was able to figure that out.
  • I noticed that attachment downloads do not work on the Android browser in hastymail (at least for me).  Possibly due to bad handling of the content-disposition header by the android browser - just letting you know even though it is probably not on your end.
Since RC8 a bug report was entered suggesting a few additional HTTP headers to be sent with downloaded attachments which I added to SVN. I was able to download an html message part using android on a motorola droid phone, though when I tried to download an RFC822 part my phone told me that the message type was unsupported.
Ok - that would be great.  I you still run into more browser-specific problems with content-disposition, as I have over the years, I have found this trick works well.  Say I have a file called mydoc.pdf that I can download via a PHP controlled request - if you link to it like /hastymail/index.php/mydoc.pdf?query_string_here and make sure to set the size and type headers, the browser will default the save as filename prompt to mydoc.pdf.

Thanks for the feedback. I will update the tracker and this thread on these issues when I can.
Jason
Reply /Quote
avatar
Re: RC8 Questions/Problems
Messed up my reply above.  "Hmm - now it is not doing it for me either.  Maybe this happened while I was tinkering with the code earlier." was in reference to the "Stop tracking unread mail in this folder" issue and "Cool - if it is easy, I think it would be a worthwhile addition.  I know I would use it quite a bit." was in reference to the multi-forward-as-attachment feature.
Reply /Quote
avatar
Re: RC8 Questions/Problems

I have updated SVN to include a slightly modified version of your sort method replacement. It still uses array_flip and isset rather than in_array. The reason for the sorting at this point in the code is because the unread UIDS fetched from the server are in no particular order, so we use the uid_cache to sort them in the same order as the mailbox. This way the unread previous and next links on the mailbox page follow the same order as the mailbox itself.

Also I would suggest upgrading to the latest SVN. You can download a prepackaged tarball of current SVN anytime from our  Download page if you are not interested in using a SVN client to pull the code. SVN is stable and currently has several fixes + improvements over RC8 (see the CHANGES file for the complete list).

Thanks again for the feedback,
Jason

Reply /Quote
Get Hastymail at SourceForge.net. Fast, secure and Free Open Source software downloads