After installing the bounce mail handler and running it manually, I get the following report:
----------
Cannot create imap connection to myserver.org
Error MSG: Can't open mailbox {myserver.org:tls/imap/notls}INBOX: invalid remote specification
Total: messages
Running in move mode

Closing mailbox, and purging messages
Read: messages
0 action taken
0 no action taken
0 messages deleted
0 messages moved

-----------

When I return to the admin page, I get:
--------------
•warning: imap_open(): Couldn't open stream {myserver.org:tls/imap/notls}INBOX in /vol/drupal_sites/all/libraries-available/phpmailer-bmh-5.0.0/class.phpmailer-bmh.php on line 265.
•warning: imap_num_msg() expects parameter 1 to be resource, boolean given in /vol/drupal_sites/all/libraries-available/phpmailer-bmh-5.0.0/class.phpmailer-bmh.php on line 322.
•warning: imap_close() expects parameter 1 to be resource, boolean given in /vol/drupal_sites/all/libraries-available/phpmailer-bmh-5.0.0/class.phpmailer-bmh.php on line 426.
-----------

(Note, /libraries/PHPMail-BMH is a simulink to libraries-available/phpmailer-bmh-5.0.0. I do this with all my modules, themes, and libraries).

The server is running TLS with a self-signed certificate. It does work on other devices with the same username, password, servername, port, and TLS on.

Any ideas?

Comments

weseze’s picture

The module is unable to connect with your mailbox. The reason why will require you to do some manual debugging...
The first thing I can think of, looking at the error message, is an incorrect INBOX name.

bwo’s picture

I get the same errors with gmail server and SSL:

Cannot create imap connection to imap.gmail.com

Error MSG: Can't open mailbox {imap.gmail.com:ssl/imap/notls}INBOX: invalid remote specification

Total: messages

Running in disable_delete mode, not deleting messages from mailbox

gdbassett’s picture

I don't believe the module gives an option for setting the mailbox. I believe the mailbox is "Inbox". (It's a default exchange server user.)

The message "invalid remote specification" makes me think the module or the library have trouble talking TLS, potentially with a self-signed system. Are there library settings for accepting self-signed certs that are not exposed in the module?

steve.m’s picture

Assigned: Unassigned » steve.m

Debugging email logins can be tough.

Not sure if this will help, but I just commited a couple of things to the dev branch:
- you can now specify the mailbox name, in case that helps
- there's a link on the settings page that will attempt to connect to the mailbox and dump all the PHP imap errors on failure

steve.m’s picture

And it looks like there was a bug in the code that didn't set the secure connection flags correctly. Try the dev version now, and see how it goes.

steve.m’s picture

Also, it looks like gdbassett is right: there is an imap_open flag that allows the use of self-signed certificates. I've added a self-signed option to the remote mailbox settings that should pass the /novalidate-cert flag through to the BMH library properly.

steve.m’s picture

Hm. The dev tarball isn't being rebuilt. Apparently I need to review the Git docs. Try checking out the latest 6.x-1.x version from source control to test secure connections and self-signed certs.

steve.m’s picture

I've created a 6.x-2.x branch that will hopefully work properly. Try that version!

gdbassett’s picture

If I have time, I'll take a whack at it tonight. If not, I should have an hour or two Saturday morning.

gdbassett’s picture

)@(#$ I just realized this means I need to remember how to sync git to the drupalcode repository.

steve.m’s picture

Check the "all releases" page -- there should be a 6.x-2.x dev release to download. I'm hoping THAT one gets re-rolled automatically with my commits.

gdbassett’s picture

awe. I see it. Will try and get to it tonight.

gdbassett’s picture

I've finally gotten to working on this again. I've installed the 2.0 dev chain. Unfortunately, running the database connection test gives a 500 internal server error and manually running the bounce gives a blank page. (Show source is literally only "

".)
steve.m’s picture

Version: 6.x-1.0-beta1 » 6.x-2.x-dev

Are the required libraries and PHP IMAP functions available? If the module cannot load the PHPMailer-BMH in the libraries path, then it will give you a WSOD from the "Process mailbox" link.

Also, I had to flush my menu cache when I upgraded, as the mailbox-testing path is new.

gdbassett’s picture

PHPMailer-BMH is in the libraries directory.

Still get 500 errors (need to check the apache log I guess).

I'll install the version from the 17th and tell you how it goes.

gdbassett’s picture

With slightly more php-imap installed on the server, BMH was able to authenticate to the server.

Running the test manually now to see what it does. (At a few thousand bounces, I suspect this may take a while. Maybe there should be an option to slowly parse through the initial backlog which may exist in a mailbox.)

edit:
Yep, it slowed down the whole server down to a crawl and http://(site)/simplenews_bmh/bounce_manual/1 times out. I'll give it an hour to work on it and see if it's better then.

steve.m’s picture

Good to hear. Note that you can set a limit on the number of messages processed per cron run.

steve.m’s picture

Ah, wait. The message limit applies regardless of how the mailbox is processed, so you can set the limit low for manual processing as well as automatic.

gdbassett’s picture

The message limit under performance management or in the BMH configuration?

Also, here's some sample output. It's not looking too promising:

Total: 3497 messages
Processing first 3000 messages
Running in move mode
Msg #1 is not a standard DSN message
Msg #2 is not a standard DSN message
Msg #3 is not a standard DSN message
Msg #4 is not a standard DSN message
Msg #5 is not a standard DSN message
Msg #6 is not a standard DSN message
Msg #7 is not a standard DSN message
Msg #8 is not a standard DSN message
Msg #9 is not a standard DSN message
Msg #10 is not a standard DSN message
Msg #11 is not a standard DSN message
Msg #12 is not a standard DSN message
Msg #13 is not a standard DSN message
Msg #14 is not a standard DSN message
Msg #15 is not a standard DSN message

(it's at msg #200 ish now with the same response)

gdbassett’s picture

Status: Active » Closed (fixed)

Ok, Ran it again with a limit on messages processed and got this:

-----

Connected to: (server)
Total: 9771 messages
Processing first 200 messages
Running in move mode

Closing mailbox, and purging messages
Read: 200 messages
1 action taken
199 no action taken
0 messages deleted
1 messages moved

------

It looks like it's working. (Granted, this was run against a message box with 9000 bounced emails and it only caught 1 out of 200, but that's a pattern issue I believe.)

steve.m’s picture

It might be a pattern-matching issue. You might also look at the mailbox to make sure that they are all bounces: the reply-to address can get actual human replies as well as bounce messages.

gdbassett’s picture

They are generic exchange undeliverables.

------

Delivery has failed to these recipients or distribution lists:

someone@domain.com
Microsoft Exchange has been trying to deliver this message without success and has stopped trying. Please try sending this message again, or provide the following diagnostic text to your system administrator.

Diagnostic information for administrators:

Generating server: mail.domain.com

someone@domain.com
#< #4.4.7> #SMTP#

Original message headers:

(headers were here)