Hi,

In version 6.x-2.4 messages are not deleted when importing from a POP3 mailbox.
I have turned on "Delete messages after they are processed".

When I try to import mails, the import progress bar stays on the screen for quite some time (screenshot 1) and after a while it throws an error message (screenshot 2). The messages are imported into Drupal. However the messages are not deleted, so next time I run the importer, they are imported again.

It looks like there is a link to issue #1368580: Messages always deleted with POP3. In my opinion it's not deleting messages anymore since this commit. I didn't have problems with the deletion of messages in one of the previous versions (before 6.x-2.3).

If you need some info or when you want me to test something, please let me know!

Comments

pvanerk’s picture

StatusFileSize
new9.22 KB
new2.55 KB

Now with screenshots

danepowell’s picture

StatusFileSize
new959 bytes

Please apply the attached patch, then try importing again, and let me know what messages show up in your dblog (watchdog) related to the import. Also please let me know if there are any errors in your PHP logs.

Also, it would help if you can confirm that the import DOES work with an IMAP mailbox, or with the local test mailbox (available in the Mailhandler quick-start module).

pvanerk’s picture

Hi Dane,

Thanks for your quick reply. I appreciate it a lot!

First of all, everything works fine when I use a IMAP mailbox (google accounts). The POP3 server is a Microsoft Exchange Server a client of us is using.

I applied your patch, however no error messages showed up in the dblog. This is the output:

Jan  7 22:17:01 --- CRON[25680]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ))
Jan  7 22:19:07 --- drupal: https://--/--/--|1325971147|mailhandler|10.10.1.XXX|https://--/--/--/index.php?q=batch&id=258&op=do|https://--/--/--/index.php?q=batch&op=start&id=258|1||Mailbox XXX@XXX.com was checked and contained 3 messages.
Jan  7 22:19:15 --- drupal: https://--/--/--|1325971155|content|10.10.1.XXX|https://--/--/--/?q=services/json||1|view|call: updated Test message  -- please do not delete.

I couldn't find any error messages in the php log also.

I also tried some older versions of the Mailhandler.

Version 6.x-2.2 is working as expected (mails are imported and then deleted on the POP3 server).
Version 6.x-2.3 is not working (same issue as 6.x-2.4)

Thanks for your help!

danepowell’s picture

StatusFileSize
new926 bytes

Hmm... as near as I can tell, the only change between 2.2 and 2.3 that would affect this is that the message gets deleted in a separate connection. So I'm guessing that imap_delete() is getting called but with an invalid UID or something...

Can you apply the patch and test again and let me know what the dblog says?

Sorry this has caused so much trouble for you... POP is not the most common connection type these days.

pvanerk’s picture

Hi Dane,

I know what trouble POP can be :-)

I have applied your patch and this is what the syslog is telling me:

Jan 10 14:38:00 pvanerk-computer drupal: http://localhost/bw/XXX|1326202680|mailhandler|127.0.0.1|http://localhost/bw/XXX/index.php?q=batch&id=267&op=do|http://localhost/bw/XXX/index.php?q=batch&op=start&id=267|1||Mailbox support_XXX_com was checked and contained 2 messages.
Jan 10 14:38:02 pvanerk-computer drupal: http://localhost/bw/XXX|1326202682|mailhandler|127.0.0.1|http://localhost/bw/XXX/index.php?q=batch&id=267&op=do|http://localhost/bw/XXX/index.php?q=batch&op=start&id=267|1||Deleting message

The nginx log:

2012/01/10 15:07:40 [error] 1177#0: *105 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /bw/XXX/index.php?q=batch&id=269&op=do HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/bw/XXX/index.php?q=batch&op=start&id=269"
2012/01/10 15:07:40 [error] 1177#0: *105 open() "/var/www/nginx-default/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "POST /bw/XXX/index.php?q=batch&id=269&op=do HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/bw/XXX/index.php?q=batch&op=start&id=269"

Still not a lot of info. Please let me know when I can do anything else for you!

danepowell’s picture

StatusFileSize
new926 bytes

Okay, that confirms my suspicion- it seems that the UID being used is invalid. I'll have to investigate- it might take some time, sorry. As a workaround, you can use the attached patch. It's hackish and may have some unintended side-effects (it will delete all messages immediately after they are retrieved), but I think it should at least make the module usable for you.

pvanerk’s picture

Thanks for your help!

danepowell’s picture

Marked #1441174: POP3 emails are not deleted as dupe. This is also any issue in the 7.x branch.

danepowell’s picture

pvanerk’s picture

Hi Dane,

Did you fix this in version 6.x-2.5?

I didn't see the code from the patch reflected in the 6.x-2.5 version, but maybe I missed it.

Thanks,

Paul

danepowell’s picture

No, the 'active' status on this issue indicates that it has not been committed, nor has a proper patch been generated. As I mentioned in #6, the patch I posted was tailored to you and not a good general-purpose solution.

sblommers’s picture

StatusFileSize
new473 bytes

Workaround for this for version 2.5

sblommers’s picture

StatusFileSize
new516 bytes

And now with corrected paths for the patch

er.yashvyas’s picture

Hey

I have been using the same module you just need to check the checkbox given in the mailbox page
Delete messages after they are processed?
and in Protocol: select POP3 with port number 110
Also this error is reported if you have not enabled php_imap extension in apache.

er.yashvyas’s picture

Issue summary: View changes

Fixed typo

danepowell’s picture

Issue summary: View changes

For any newcomers to this thread, note that none of the patches here are intended for general use- they are only workarounds and will have side effects.