I'm testing this module for the first time and I'm impressed. But...

All messages are getting deleted even with the «Delete messages after they are processed?» left unchecked. This happens on a test import with base_url/import/mailhandler_nodes and the option «Ignore authentication», since the retrieved messages came from unregistered users/emails (as in #1260106: Accomodate posts from anonymous users).

Debug:

$mailbox = new stdClass;
$mailbox->disabled = FALSE; /* Edit this to true to make a default mailbox disabled initially */
$mailbox->api_version = 2;
$mailbox->mail = 'account_site_com';
$mailbox->admin_title = 'account@site.com';
$mailbox->settings = array(
  'type' => 'pop3',
  'folder' => '',
  'domain' => 'mail.site.com',
  'port' => '110',
  'name' => 'account+site.com',
  'pass' => 'password;',
  'extraimap' => '/notls',
  'limit' => '1',
  'encoding' => '',
  'mime' => 'TEXT/HTML,TEXT/PLAIN',
  'delete_after_read' => 0,
  'fromheader' => '',
  'security' => '0',
  'replies' => '0',
  'retrieve' => 'MailhandlerPhpImapRetrieve',
);

Comments

Dane Powell’s picture

Title: Messages deleted even with delete option off » Messages always deleted with POP3

Yeah, it's because you're using POP3. Unfortunately, the protocol is extremely limited- you can't just mark messages as read, and you can't retrieve UIDs (unique identifiers for messages), meaning the 'ignore authentication' / 'keep unpublished' / etc... option can't be implemented.

I'll look into this and see what I can do. I can probably at least implement deleting messages after they are retrieved, but implementing the authentication options will require finding an alternative to the imap_uid() function.

Dane Powell’s picture

FYI, #1343606: Option to prevent re-importation of messages is a workaround to not being able to mark messages as 'read' over POP3.

Encarte’s picture

Thank you Dane. I forgot to mention that the nodes were successfully created before the messages were deleted. So, the POP3 option works, it just doesn't work if you want to keep your mail on the server.

Some kind of validation for POP3 and the delete option or even some simple warning (similar to «Note: Security=Enabled and MIME preference=HTML is an unsupported combination.») would be nice while the issue isn't solved (and I guess it will take a good while). I think that would make this issue into a minor priority feature request.

Dane Powell’s picture

Component: Code » Mailhandler
Status: Active » Postponed (maintainer needs more info)

Okay I think I fixed this in both branches:
http://drupalcode.org/project/mailhandler.git/commit/0cc4ad7
http://drupalcode.org/project/mailhandler.git/commit/b1395f9

However, I don't have any POP3 mailboxes so I have *not* tested it. *Please* test teh development release that rolls tonight and let me know if it does work.

Dane Powell’s picture

Component: Mailhandler » PHP IMAP library
Encarte’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Status: Postponed (maintainer needs more info) » Active

After updating to the latest dev (2011-Dec-17) and changing to POP3, I get this error message:

warning: imap_header() [function.imap-header]: Bad message number in /home/site/public_html/testsite/sites/all/modules/mailhandler/modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php on line 354.

There is also a «There is no new content.» info message and no node is created.

I also noticed this sentence in the module release log: «You will need to update your existing importers to use the appropriate mapping source.» but I didn't understood what exactly needs to be updated. I don't know if this is related with the problem.

Dane Powell’s picture

Status: Active » Fixed

@Encarte: Let's deal with your new issue at #1375094: Error "bad message number" when retrieving from POP3 mailbox

Re: your second question, what I meant is that after the update, the HTML body of an email (if available) will be imported by default. If you'd prefer to retrieve the plain-text body, you'll need to edit your Feeds importers (at admin/build/feeds).

Dane Powell’s picture

... I'll add help text to the update making this more obvious.

Encarte’s picture

Thank you Dane. Indeed, there is no more deleting messages going on :)

Dane Powell’s picture

Here's some more info on the update:

With this update, the body MIME type (text/html) is no longer set on a per-mailbox basis. Instead, the HTML and plain-text bodies are now available as mapping sources in Feeds importers.

If your site had any existing importers, they have automatically been updated to retrieve the HTML body. If you want to import the plain text body instead, you will need to update your importers to use the appropriate mapping source by going to $base_url/admin/build/feeds, selecting the importer, selecting 'mapping', and changing the 'Body (HTML)' source to 'Body (plain text)'.

Status: Fixed » Closed (fixed)

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