Installed 6.x.2.dev version released a few days ago. When a mailbox was empty the import appeared to work, but if a message was in the box I got an HTTP 500 error. That is similar to what happened when I upgraded from 6.x.1.17 to 6.x.2.0-rc1. Then, I fixed it by deleting the old mailboxes and recreating them. But it did not work with the 6.x.2.dev version, so I uninstalled mailhandler and installed 6.x.2.1 clean.

Now I can't create mailboxes or import them. In either case, when I click Update or Save I get a page of HTML code like the following. Nothing is saved in the database. I was able to create one mailbox by manually inserting it into the db and then filling in the settings through mailhandler. But when I tried to do that with a second mailbox it started giving me a page of code.

{ "status": true, "data": "\x3cdiv id=\"mailhandler_test_results\" class=\"form-wrapper\"\x3e\x3c/div\x3e" }<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="fb:app_id" content=""/>

<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
    <title>Edit mailhandler mailbox og_discussion_groups | Kehila Chadasha</title>
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/admin_menu/admin_menu.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/book/book.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/admin.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/calendar/calendar_multiday/calendar_multiday.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/cck/theme/content-module.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/ckeditor/ckeditor.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/ctools/css/ctools.css?8" />
...

Comments

danepowell’s picture

Priority: Normal » Major

It sounds like there are two issues here- the error on mailbox creation, and the error on upgrade, which you may not be concerned about any more but I would like to investigate.

Regarding the error on mailbox creation, can you tell me what you have selected for "Retrieval library"? I notice that if you have the Dummy library selected, it results in an error that may be this.

rsbecker’s picture

I tried with both retrieval methods and got the error each way.

danepowell’s picture

It looks like this is due to the AJAX connection testing. I'd like you to do two things:

1) Install 6.x-2.x-dev
2) Try to create a mailbox again. As you fill in the "connection settings", you should see a 'please wait' and spinning cursor next to the fields momentarily, and then a message below the settings telling you that the connection either succeeded or failed. Make sure that you have the settings correct, and don't click 'Save' until you see the message and there's no more 'please wait' / spinning cursors anywhere.

rsbecker’s picture

I have some good news and some bad news. First the good news

It appears that existing boxes work properly after the upgrade. It also appears that I can create new mailboxes and they work. I'm not getting the HTTP 500 errors when there are messages waiting in the mailbox.

But I could not import a mailbox that I had exported before the upgrade. There are two things I noticed about this. After the upgrade I exported a box, deleted it from the website, then imported it. There is one more line in the definition of the box, the 'retrieve" line. But I do not think that is the problem. I think the problem has to do with the test. I am sometimes getting the following error message after clearing caches:

Invalid argument supplied for foreach() in /var/www/html/drupal/sites/all/modules/mailhandler/mailhandler.module on line 308.

That is where the test helper is in mailhandler.module. Also, I noticed that when you import, the test does not run automatically. But if you change the Extra commands field, which by default appears to be /notls, the test runs. Then, when I saved the mailbox it worked fine. But if the test does not run, or it fails, I get a screen full of HTML code when I try to save or update.

So the fix would appear to be a more graceful exit when the connection test fails or does not run for some reason.

Thanks for all your work on this.

danepowell’s picture

Title: Can't create or import mailboxes » Errors on upgrade and mailbox import

Okay, so I've committed a few fixes that should solve most of the issues. The screen full of code after a test runs, and loads of IMAP-related errors when tests fail, etc... should be fixed by other commits. Also, there's an issue in the queue to add a manual testing option, for instance for imported mailboxes.

I'm still concerned about, and am going to investigate, errors on upgrade and errors on import. I'll let you know if I need any more information for that. Thanks for testing and for your patience.

danepowell’s picture

Title: Errors on upgrade and mailbox import » Errors when importing mailboxes exported by an older version of Mailhandler
Status: Active » Fixed

I couldn't find any problems with upgrading.

If you import a mailbox definition that was exported by a previous version of mailhandler, this will result in an error, so I bumped the mailbox definition api version in both branches:
http://drupalcode.org/project/mailhandler.git/commit/e28fd75
http://drupalcode.org/project/mailhandler.git/commit/4f23d5f

Let me know if you have any other issues.

chiney2019’s picture

Hi Dane,

I have same issue reported by rsbecker, when I'm creating new mailbox and save it, I got source code:

{ "status": true, "data": "\x3cdiv id=\"mailhandler_test_results\" class=\"form-wrapper\"\x3e\x3c/div\x3e" }



I tried with 6.x-2.x-dev and 6.x-2.2 versions, but no luck on this.

Not sure if this can help, but now in status I get this : "Mail Comment dependencies Not found or incorrect versions
Mail Comment is not compatible with your versions of Mailhandler or Notifications."

I tested with fresh install of atrium and still happens.

Appreciate your help on this.

danepowell’s picture

@danielvalbuenasosa - Can you please follow my instructions in #3 and let me know if they work for you? Re: the status errors, are you sure you are using Notifications/Messaging 6.x-4.x ?

rsbecker’s picture

Component: Code » Mailhandler

This problem appears to be back. I downloaded the most recent dev versions of mailhandler and mailcomment today and if I go into an existing mailbox and then save it I get a white screen with the following:

{ "status": true, "data": "\x3cdiv id=\"mailhandler_test_results\" class=\"form-wrapper\"\x3e\x3cdiv class=\"messages status\"\x3eMailhandler was able to connect to the mailbox.\x3c/div\x3e\x3cdiv class=\"messages status\"\x3eThere are 0 messages in the mailbox folder.\x3c/div\x3e\x3c/div\x3e" }

So, it appears that the connection test is running, but it is not returning me to a page.

I have also found that when my comment importer runs it reports that there are no new comments, even as it has imported a comment and attached it to the correct node.

I have run update.php and cleared the caches since installing the new modules.

I have tested them on only one site so far. I will try another site tonight and see if that makes a difference.

danepowell’s picture

Status: Fixed » Postponed (maintainer needs more info)

When you 'edit' a mailbox, do you actually change any fields, or just click 'edit' and then click 'save'? The connection test should only run as soon as you modify a field. If you save the page while the test is running, this error might occur.

If you just click 'save' and never modify a field, the test should never run, so this shouldn't be an issue.

rsbecker’s picture

I did not change anytging. I think it should exit more gracefully in that case.

danepowell’s picture

Status: Postponed (maintainer needs more info) » Active

Okay I will try to investigate- but I'm not sure why that error would occur if you are not changing any form fields...

rsbecker’s picture

In the latest dev version the From header field is populated with "From". I installed the latest 6.x-4.x-dev version of messaging and was still having a problem with populating the reply-to field in outgoing messages. I removed "From" in mailhandler to see if that changed anything. The connection test did not appear to run when I changed that field and I got the same message, a white screen with the string saying that the connection test had succeeded. So the problem happens when the form is changed. I also tried changing the extra commands field, which should invoke the test. But when I saved the same problem occurred.

BTW, the reply-to thing had nothing to do with mailhandler. It is due to a problem with messaging-phpmailer module that is easily fixed.

danepowell’s picture

Title: Errors when importing mailboxes exported by an older version of Mailhandler » Errors when saving mailboxes
Version: 6.x-2.1 » 6.x-2.x-dev

Re: the reply-to issue, if you are using Mail Comment, you might want to follow #1391980: Reply-to address may be invalid. I'm not sure it's necessarily a bug with PHPMailer.

Previously you said that if the connection test succeeded, the white screen of junk didn't appear and everything worked fine. But now you are saying that even if the connection test succeeds, you still get a white screen of junk?

I'm still not able to recreate this. Do you have Javascript enabled? What browser and OS are you using? What version of Drupal core?

danepowell’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
danepowell’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Without more information I'm afraid there's not much I can do to help.

rajeevk’s picture

Hello All,

I am also getting the same problem for "No retrieval plugins are available. Please enable a module providing a retrieval plugin, such as the Mailhandler PHP IMAP module." for my drupal version 6.22

When I am trying to add user it's giving this error at first time & if I am trying to save it again then it's showing "HTTP Error 0" & forwarding me to HTML syntax page full of coding...

Which looks like -

{ "status": true, "data": "\x3cdiv id=\"mailhandler_test_results\" class=\"form-wrapper\"\x3e\x3c/div\x3e" }


............
............
............

I am having all the required module activated.

Can you please help me ?

Thanks,
Rajeekr

rajeevk’s picture

Issue summary: View changes

When I first created this message it saved, but the text was not visible.