Download & Extend

cron isn't triggering mail handler

Project:Mailhandler
Version:6.x-1.x-dev
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

If I retrieve the mail manually, mailhandler works....cron is running successfully, but it isn't triggering mailhandler to go get the mail. What can be done?

Comments

#1

It sounds like there might be a module running in cron before mailhandler, which either takes up more time than it should or drops out once it's done. What other modules do you have running on cron?

#2

Version:6.x-1.5» 6.x-1.x-dev
Status:active» needs review

Cron doesn't works, because mailhandlers opens imap session two times. Here's a fix.

AttachmentSize
mailhandler_cron_fix.patch 1.69 KB

#3

I tried using that patch, it didn't seem to help.

#4

Correction, it seems mailhandler works when I run cron manually, but not when it runs automatically. When I look at the logs, it seems the manually runs are done by me while the automatic ones are done by anonymous. Could this be the issue?

#5

I also have this problem : when I test the connection with the mailbox, and if i retrieve manualy the mails, it works perfectly (for both POP and IMAP).

But when i run a cron (both automaticaly or manualy) I get this for POP :

    * warning: imap_open() [function.imap-open]: Couldn't open stream {mail.xxxx.be:110/pop3/novalidate-cert/notls}INBOX in /home/xxxx/domains/xxx.be/public_html/xxxxx/sites/all/modules/mailhandler/mailhandler.module on line 193.
    * warning: imap_close(): supplied argument is not a valid imap resource in /home/xxxxx/domains/xxxx.be/public_html/xxxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 625.

And this for IMAP :

    * warning: imap_header() [function.imap-header]: Bad message number in /home/xxx/domains/xxx.be/public_html/xxxxxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 636.
    * warning: imap_fetchstructure() [function.imap-fetchstructure]: Bad message number in /home/xxx/domains/xxxx.be/public_html/xxxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 60.
    * warning: imap_fetchstructure() [function.imap-fetchstructure]: Bad message number in /home/xxxx/domains/xxxx.be/public_html/xxxxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 60.
    * warning: imap_fetchstructure() [function.imap-fetchstructure]: Bad message number in /home/xxxx/domains/xxxx.be/public_html/xxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 121.
    * warning: imap_close(): 75 is not a valid imap resource in /home/xxxx/domains/xxxx.be/public_html/xxxx/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 752.

And not a single mail is retrieved...

Any idea ?

mailhandler 6x-1.x-dev

-P-

#6

Status:needs review» active

#7

Bump !
Does anyone could give a hand on that problem ?

I can connect to the mail box
I can retrieve mails manualy
but Cron doesn't do the job...

Logs says :
one time per cron : Could not fetch structure for message number 11
and two times per cron : imap_close(): 74 is not a valid imap resource in /home/.../sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 684.

I spent hours on different try out with no success... and I still have no idea what goes wrong..
I would really appreciate any advice.

#8

did you tried my patch?

#9

Yep ! It works !

I first tried to patch mailhandler.module file, and had no results
I realised the file to patch was mailhandler.retrieve.inc... Ooops !

Thanks !!
Sorry for not looking more carefully ;)
-P-

#10

Status:active» reviewed & tested by the community

so, setting issue to RTBC

#11

Marked http://drupal.org/node/595314 as duplicate. I applied a patch very similar to #2 by @neochief. The difference being to only proceed if there are actually new messages. I believe the problem like neochief states, and more specifically, there are problems w/ certains stacks (php/os's) when one imap session is opened before a previous is closed. Now, session is opened, closed, then opened again. This is not most efficient and may refactor later. I've commited this, and can be further tested on the 6.1 dev branch. I'll leave open until more positive feedback.

#12

I can confirm that on 6.x-1.8, I was experiencing the bug as described here.

Upgrading to 6.x-1.x-dev (Dec 5th) solved the problem.

Thanks all!

edit: Since the ticket title does not describe exactly what I was experiencing, but other comments detailed the same issue, I wanted to clarify that I was receiving the following error during cron, but manual execution worked fine:

imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {EXAMPLE.com:110/pop3}INBOX in /var/www/html/sites/all/modules/mailhandler/mailhandler.module on line 193.
imap_close(): supplied argument is not a valid imap resource in /var/www/html/sites/all/modules/mailhandler/mailhandler.retrieve.inc on line 650.

#13

@jgraham I am glad it is working for you now. Could you let me know what operating system and php version you are using? Thanks

#14

@Ian Ward: Fedora 10, PHP 5.2.9

#15

Just wanted to add that if two cron instances run at the same time this issue may show up again.

I don't think anything can be done by mailhandler about that scenario though.

#16

We had a very similar problem. We ran through supercron and confirmed mailhandler was the issue. Upgrading to 6.x-1.x-dev (Dec 5th) solved the problem for us too.

#17

Status:reviewed & tested by the community» fixed

This has been fixed

#18

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here