Hi,
I wanted to use the mailhandler module on a hosting server that does not support the IMAP extension.
Since mailhandler only uses a subset of the imap_x functions and I only needed to retrieve mails from a pop3 box it was relativly easy to reimplement the imap api in 'userspace' (no idea how you call that in php land, this is my first php work).
In the attached patch a new file 'user_imap.inc' is supplied which implemts this minimal implementation if the real one is absent.
I have tested it on two servers and with various mail clients (for generating the mail) and seems to work fine. It might be wise to test and review it more though.
I also changed the taxonomy passing a little bit. otherwise the simplenews module would not parse it.
No idea if this is 100% right, but now simplenews (with a new mailhandler hook) works fine with it.
Regards,
Jeroen
p.s.
Since I am also new to drupal module stuff I have no idea if this is the way you like patches.
If not my apologies.
| Comment | File | Size | Author |
|---|---|---|---|
| mailhandler.user_imap.patch | 28.15 KB | pe1rxq |
Comments
Comment #1
ilo commentedOh man, this is super awesome!! Actually, that is a 'key' to succeed in get rid of the imap extension as long as making the pifr infrastructure able to test the module.
I'll tag this to be completed before we go for the 7.x version!
This is a very big patch however, we need to split up code into 'functional chuncks' that we are able to test, and make sure they work before removing the imap dependency. Let me make a review and I'll update the issue with appropiate tasks.
Thanks so much!
Comment #3
pe1rxq commentedmailhandler.user_imap.patch queued for re-testing.
Comment #5
ilo commentedmmm patch will not apply because you have to use relative paths in the patch file (http://drupal.org/patch/create) :
should be:
Unfortunatelly, there are no tests for the IMAP part, so even if test results are ok, the patch might fail in its purpose.
Comment #6
ilo commented@pe1rxq, can you confirm that this code is GPL licensed or any Drupal compatible license?
Comment #7
pe1rxq commentedYes,
The code is written by me. The GPL is fine by me.
Comment #8
TimelessDomain commentedhas anyone tested this? thanks pe1rxq for making this gpl!
Comment #9
chey commentedmailhandler.user_imap.patch queued for re-testing.
Comment #11
Encarte commented+1
Comment #12
danepowell commentedI doubt this will make it into 6.x-1.x or 7.x-1.x, but please consider working on integrating it into 6.x-2.x / 7.x-2.x: #1357638: Alternative to PHP IMAP retrieval library
All you'd need to do is copy MailhandlerPhpImapRetrieve.class.php and MailhandlerPhpImapRetrieve.inc.
Comment #13
danepowell commentedActually I'm going to mark #1357638: Alternative to PHP IMAP retrieval library as duplicate, so we can concentrate effort in this issue. This should be relatively easy to port between 1.x/2.x, as I mentioned in #12.
Another possible library to use: http://www.phpclasses.org/browse/package/2351.html
Finally, if 3rd-party code is used (if it is primarily hosted and maintained somewhere other than on drupal.org), then it should be included as a Library, and not distributed with Mailhandler.
Comment #14
Anonymous (not verified) commentedHi all
how can i use "without php_imap" with 7.x version?
i am ready for tests :-)
Best regards
ArchGalileu
Comment #15
danepowell commented@ArchGalileu There's currently no alternative to the PHP IMAP module / extension. That's what this issue is advocating :) If you are looking to help with development, what needs to happen is to clone the mailhandler_php_imap module, making sure to define the retrieve(), test(), and purge_message() functions.
Comment #16
Anonymous (not verified) commentedUps @Dane Powell
that's what i don't know how to do, just translate and follow specific instructions i can :-)
I will be following and ready for instructions.
Best regards
ArchGalileu
Comment #17
danepowell commentedComment #18
danepowell commentedI did an extensive search for possible PHP IMAP alternatives, and here are the best two:
Horde IMAP client library
Net_IMAP (PEAR)
Those are most desirable because they are open-source and currently-maintained on well-known frameworks.
Other options, probably not ideal, are the OP's patch and the code snippet linked to in #13.
Again, all that needs to happen is to clone the mailhandler_php_imap module and rewrite the retrieve(), test(), and purge_message() functions to use the new library rather than PHP IMAP functions.
Comment #19
hanksterr7 commentedHi. What is the status of this effort? I'd like to enable mailhandler on my Go Daddy shared hosting Drupal 7.x-2.x site and believe I need something like this IMAP alternative to do that. The discussion so far makes it sound like that is not yet possible.
Thanks
-- Hank
Comment #20
panchoLooks like Horde IMAP is indeed state of the art and seems to be well supported.
We can also use the performance boost they're advertising, especially the optional integration with imapproxy sounds interesting.
If it really proves to be faster than native PHPIMAP, we could even make this default and drop the PHPIMAP extension requirement.
While the library does much more than we need, we're finally a framework, and well-supported third party code is clearly preferable to custom code that we have to support ourselves.
Assuming that it should be GPL-compatible but can't find any concrete license information though.
Comment #21
danepowell commented@hank - Correct, not yet possible. If you're interested in sponsoring development let me know, but this would be a pretty big project and I don't have plans to undertake it at this time.
Comment #22
kscheirerSeems great! The instructions are pretty clear:
If someone wants to take this on I think it would be a great addition. Any 3rd party libraries used should be included with the Libraries API module. If someone was interested in porting the original patch to a full class, then this would work for hosts without php-imap installed. The original patch does not look appropriate for the module anymore though.
Comment #23
danepowell commentedHappy to take a look at patches but not going to implement this myself.