Mailhandler: Can't Open Stream...modules/mailhandler/mailhandler.module on line 29.
kdrewnj - March 7, 2007 - 01:16
| Project: | Mailhandler |
| Version: | 6.x-1.7 |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Description
I receive the following error when trying to manually retrieve: warning: imap_open() [function.imap-open]: Couldn't open stream {pop.gmail.com:995/pop3}INBOX in /home/u7/XXXX/html/d/modules/mailhandler/mailhandler.module on line 16.
Drupal 5
Thank you.

#1
you can't connect to own POP mailbox. only you know why.
#2
I can connect to my mailbox, just not using mailhandler....
#3
Ok, tried another account, and now I receive this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
"Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error."
Thanks for your help.
#4
I have the same problem:
warning: imap_open() [function.imap-open]: Couldn't open stream {mail.MYDOMAIN.com:110/pop3/novalidate-cert}INBOX in /home/MYPATH/sites/all/modules/mailhandler/mailhandler.module on line 16.
Mailhandler POP3 connection failed: prova02@MYDOMAIN.com
The setup and mailbox retrieval have been working while the site was on an external, development server. Mailhandler has stopped working when I moved the site to the production server, which also contains the mail server.
Any ideas?
Thanks in advance for any assistance
--
Albert
#5
I'm having the same problem as the initial report, using v5.x-1.1. The POP3 mailbox works fine when I'm connecting to it from Outlook but it won't work from Mailhandler:
warning: imap_open() [function.imap-open]: Couldn't open stream {pop.googlemail.com:995/pop3} in W:\www\drupal\sites\all\modules\mailhandler\mailhandler.module on line 16.Note that I'm also using Googlemail/Gmail, which requires port 995. Is there some specific setting which that mailsystem requires which Mailhandler doesn't like or know about?
#6
I too am stuck with this tonight!
I tried with '
/ssl'under 'extra commands' to force it to use ssl which google requires.but i still get an error:
warning: imap_open() [function.imap-open]: Couldn't open stream {pop.googlemail.com:995/pop3/ssl}does this work for anyone or is there another command i must add?
#7
Just a follow-up to my last post, in case anyone else has the same problem. I have discovered that my host (hostmonster) blocks port 995. I verified this by trying
telnet pop.googlemail.com 995from the host. In my case this explains why I could connect from my pc with a mail reader, but not from the Drupal on my host.#8
That's not my problem - I'm testing the mailhandler on my workstation, which can connect to Googlemail via both Outlook and telnet. Aspags, could I ask you to e-mail me the details of your Mailhandler mailbox configuration (without username/password, natch) at adam@knowledgeview.co.uk so I can see if I've left out something obvious? Many thanks.
#9
same problem as #6.
subscribing
#10
doesn't work for me either
#11
Any progress on this? I'm having the same problem in Drupal 4.7. It is driving me batty!
warning: imap_open() [function.imap-open]: Couldn't open stream {mail.XXX.org/pop3/ssl/user=XXX@gmail.com:26}INBOX in /home/XXX/public_html/XXX/modules/mailhandler/mailhandler.module on line 13.
#12
I'm having a similar issue, and I wonder if the issue arises when the email's domain is different from the site's domain.
It seems most of you guys are using Mailhandler with gmail. I'm not using gmail, but I am trying to pull from an account I have on a different server on a different host.
Once I finish testing the new host I'll transition my email over there too and see if it works.
-Patricia
#13
Same problem. Yup. Using googlemail.
#14
Using gmail account too...Don't get above error (after user /ssl command), but can't retrieve messages...Just showing Mailhandler retrieve susscesful: 0 messages for user@gmail.com...However, I get this for all of my add external host accounts...
#15
Per my above message, I've completed host transition so the domain for my email and my site are now the same. I don't get the error anymore, and successfully retrieved email.
But it sounds like at least one person didn't get the OP's problem using gmail, so maybe that's not the only problem. Some other things to double-check...
-Username for the email account. It may need to be USERNAME@DOMAIN.COM, not just USERNAME
-Be sure the posting email has an account with sufficient privileges to post
-IMAP vs. POP. Make sure your port settings, etc. are consistent with what your mail provider allows
-Patricia
#16
I too am having this issue and have read every possible thread on the issue. Nothing has fixed the problem. I always get IMAP connection failed or POP3 connection failed errors. I can connect to my mailbox, just not with mailhandler. I am using a mail account on the same server as my drupal install. I have tried adding the /notls command. I am connecting with username@domain. No luck.
#17
Hmmm. Not sure what's going on, but I made another email account on the same domain, and that is working. Not sure exactly why that changed it, but nevertheless it worked. So before I tested that second account, or even set it up in mailhandler I did the following:
telnet into it from my DRUPAL machine (via ssh) -- for info on telnet to email account see here http://members.tripod.com/~smanage/tel.html
after that was successful I made sure to set up a user account in drupal with the same email address I would use for mailhandler. i gave this user authenticated status only.
set up mailhandler accordingly, with the /notls as an extra command
excellent!
#18
It does appear to be an issue with Gmail; or at least with port 995. I also get this problem with Gmail, but using another domain (via the standard non-SSL port 110) it works fine. A shame, as I'd much rather use Gmail.
#19
Quick checklist for gmail/google apps:
* POP is enabled in Gmail (login to your gmail account, go to settings > Forwarding & POP - then enable)
* If google apps (NOT gmail), make sure email account is working and that MX records have propagated and can be accessed by drupal server.
* Ensure port 995 is NOT blocked (some hosts block this by default. ask your host or try telnet, etc.)
* Mailhandler set for using POP (not IMAP)
* INBOX
* Extra commands: /ssl/novalidate-cert
after all this, and you receive the error "Invalid remote specification" check this out: http://drupal.org/node/64362
note: this was written (& tested) before gmail offered IMAP.
#20
I'm a bit new around here, so forgive me if I've overlooked anything. Overall a great, if not critically important, module, but a few steps shy of perfect...
I finally got mailhandler installed (latest regular release, not the dev version) and after wrestling with the "can't open stream" error for awhile came up with what has worked for my situation, and some suggestions for others in future.
- I've got my setup running on Ubuntu (7.04) and had to install postfix and dovecot to get past just enabling the module. I can't speak for other distributions, but this needs to be highlighted a bit more someplace as I managed to completely overlook it if it was mentioned, and sending us to _anything_ in the php docs is a bit, well, less pleasant than a simple explanation of what was needed.
- As I was connecting via IMAP to the local IMAP server, none of this google stuff mattered, but I did need to put /notls as one of the flags as I didn't install the TLS stuff along with the postfix install.
- NO SPACES in the flags... Can spaces be stripped out automatically?? IE, I had entered "/notls" and the space was one of the problems.
- It would've saved some time if the imap_last_error() could've been displayed in addition to the "can't open stream" message as the last_error is very helpful information, not sure why it isn't provided? I added it to my install to test and it worked just fine, but I don't know how to add it in _properly_ much less contribute a patch or anything like that (yet...).
Overall, the /notls, without spaces, I think would've solved my initial problems but it took a long time to get around to figuring out where the problem was. I don't mind going through the PHP docs (that's where the "imap_last_error" info was from, after all) but its, well, a bit of a shock to land in there if you don't live and breath PHP. Going from the regular Drupal admin tasks to the PHP docs is like going from a nice glass of champagne to chewing on sand...
Thanks!
#21
I was having this issue while setting up using a Google Apps email account. Following mdrmike advise, specifically adding "/ssl/novalidate-cert" to extra commands, got me up and running.
#22
so glad to hear #19 comment helped you out... i spent close to a week (on & off) troubleshooting.
fwiw, i changed my login from mdrmike to my real name
#23
I've been tearing my hair out with this problem for the past 12 hours or so ... eventually I found a nice little note in the Dreamhost (clients web host) Support Wiki - [http://wiki.dreamhost.com/Drupal_Troubleshooting]
it says that I'm getting the
"warning: imap_open() [function.imap-open]: Couldn't open stream /home/mixislogistics/Maildir/ in /home/.mara/themixis/store.mixis.com/sites/all/modules/mailhandler/mailhandler.module on line 34"
error
"... because the imap_open extension is not included in the default PHP compiles offered by Dreamhost"
I imagine that the same sort of error would appear in any situation where the server wasn't compiled with the imap_open extension.
Its also unfortunate that Mailhandler relies on this extension to make connections to POP3 email as well as IMAP. There's no way around it shy of hacking the module, or changing the server situation, as far as I can see.
If I'm missing something, or if anyone knows a way already of hacking the mailhandler module to not rely on the imap_open extension for connections to POP3 email, please post it.
Danke.
#24
the imap extension handles pop3 as well. it is poorly named. we don't just rely on it for fun.
#25
FYI, if you're on site5, try adding:
"/novalidate-cert"
to the extra commands. Fixed it fer me.
--Jake
#26
The simple mistake that was causing it for me and might be holding some others up was that I had /notis with an 'i' instead of /notls with an 'l'.
Good luck.
jarea
#27
I was able to get working on Dreamhost as of today, with "/notls" using IMAP on port 143. Just in case anyone else is struggling. Apparently DH compiled imap_open into PHP...
#28
I'm also getting this error, and the posts here have been very helpful.
I have contacted my host (IXHosting) to get the ports open to interact with Gmail servers, and this was their response:
This was my reply:
Does anyone out there know really how to answer their question and why they are asking it? It doesn't make any sense to me, but then again I'm novice when it comes to some of this stuff.
I hope that answers your question enough to open these ports. If not, I will continue to look for more detailed answers.
Thanks in advance for you help!
Steve
#29
Your provider is using a firewall and wants to restrict each port to one (or more) specific IP addresses.
I have looked up the IP addresses for you:
# dnsip imap.gmail.com
64.233.183.111 64.233.183.109
# dnsip pop.gmail.com
64.233.183.111 64.233.183.109
# dnsip smtp.gmail.com
64.233.183.111 64.233.183.109
So those are the ones in use by google at present, bear in mind that this might change ;-(
connection type is TCP
HTH
#30
Thanks Hutch.
Unfortunately, now they are telling me they (IXHosting) are telling me that will not open these ports for me. So I guess, I'm just SOL for using this module. I'm crying fowl, but I don't know if I'll get anywhere with them.
Steve
#31
Today, more than 72 hours after first requesting the required ports be opened to me for this, my host, IXHosting, has told me that they definitely will not open up these ports because
So I guess now, I will start searching the forums for hosts people recommend for hosting their Drupal Sites.
Very Frustrating!
But thanks for help once again.
#32
Just wanted to share my findings, for those having root access on Linux.
If phpinfo() doesn't mention IMAP, you don't need to recompile PHP! Just do as follow:
1. Install IMAP : # sudo apt-get install php5-imap
2. Add IMAP on php.ini : # sudo dpkg-reconfigure php5-imap
3. Reload Apache (with no interruption, better than restart) : # sudo /etc/init.d/apache2 reload
If you're using php4, correct accordingly.
Cheers,
Vianney
#33
I run several Drupal sites on eroute.net. They are very accomodating and have a good Linux environment for Drupal.
#34
With imap, make sure that the extra command is /ssl and that the username includes @gmail.com.
#35
i am trying to retrieve mails from php code using gmail pop but it is showing error
Warning: imap_open() [function.imap-open]: Couldn't open stream {pop.gmail.com:995/pop3/ssl/novalidate-cert}INBOX in /var/www/subdomains/raja/httpdocs/raja_new/email/bounceback_class.emailtodb_raja_email.php on line 67
Notice: Unknown: Can't open mailbox {pop.gmail.com:995/pop3/ssl/novalidate-cert}INBOX: invalid remote specification (errflg=2) in Unknown on line 0
i tried all the above cases but no use please can any one help out
#36
I too seem to get the same error though the line number referred is different - that is line 29
i ma trying to connect to my own site
warning: imap_open() [function.imap-open]: Couldn't open stream {http://www.mysite.com:110/pop3/notls/novalidate-cert}INBOX in /home/genie/public_html/modules/mailhandler/mailhandler.module on line 29.
tried diff commands also - no luck
any suggestions
#37
Had problem with Mailhandler not being able to access my mailbox however **problem solved** by
1) reading through this thread (as it seems all our problems differ)
2) following the 'imap_open' link( http://php.net/imap_open ) in the Mailhandler/Add Mailbox configuration page itself under Extra Commands
The imap_open link gave insight to additional commands.
In my case, I am using a shared-hosting package where the name of the server is different to my mail server name so it presents a issue with validating the certificate (don't know the technical terms). So I added the command:
/novalidate-cert
in the extra commands field in Mailhandler configuration. This seems to solved the problem , at least at the 'Test Connection' phase of the set-up.
Now to see if it actually works when sending email...
#38
Re: my post #37, ok so it does work, with a few further tweaks to the configuration. The post uploads with manual retrieve. Though even though it's set to HTML, the test picture did not show, but bold italics and underline did. This seems to be an issue with my drupal setup though (I think).
Not sure how to get the Cron going though. Is that another plugin or a server side set-up?
Now to work out how to be able to include images in drupal/mailhandler....
Gee, will I ever get time to actually USE this thing, or is it just about configuring and building (rhetorical question, no need for answers on this last point!)
#39
in reply to #38: "
Not sure how to get the Cron going though. Is that another plugin or a server side set-up?"
use poormanscron:
http://drupal.org/project/poormanscron
#40
this switch worked for me, at least in testing the connection.
/novalidate-cert/notls
note that there is no space between the commands as mentioned in previous posts.
in my setup I connect to an external IMAP mailserver.
Mailhandler configuration:
Folder: leave empty
Extra commands: /novalidate-cert/notls
Mime preference: HTML
Security:disabled
Cron processing: enabled
#41
The settings listed in post #40 here worked for me as well - my site is hosted at Dreamhost.
#42
To re-iterate for POP testers - answer #37 fixed my problem.
To wit:
- I had a POP mail acct
- I was getting the imap_open error message
- I added /novalidate-cert
And it worked! (After I discovered that I forgot the leading slash...)
Now, like rob0 - to test the image functionality!
#43
I was able to get it working with Imap and Google Apps using
Host: imap.gmail.com
Port: 993
Options: /novalidate-cert/notls/ssl
No spaces!
#44
I marked the bug #406348: Couldn't open stream as a duplicate of this current report.
I had "Couldn't open stream" problems, and put
/novalidate-cert/tlsin Extra commands resolved the bug.#45
Just for the record.
You might use the test script in http://drupal.org/node/315779#comment-1069604 to test the e-mail function of your server/provider.
hth
Frank
#46
warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/novalidate-cert/notls/ssl} in /drupal/sites/all/modules/mailhandler/mailhandler.module on line 193.
i had IMAP
/novalidate-cert/notls/ssl
port: 993
I am also testing this on a localhost
#47
Thanks to j0rd (comment #43)! This fixed my problem:
Host: imap.gmail.com
Port: 993
Options: /novalidate-cert/notls/ssl
#48
I just installed mailhandler version 6.17 and I've been trying to set it up. All my efforts have been unsuccessful.
What I've been trying to acomplish is connect to my regular gmail account.
My settings are :
E-mail address: daniela@gmail.com
Second E-mail address:
Folder: INBOX
POP3 or IMAP Mailbox: IMAP
Mailbox domain: imap.gmail.com
Mailbox port: 993
Mailbox username: daniela@gmail.com
Mailbox password: yyyy
Extra commands: /notls (I've tried many different such us /novalidate-cert/notls/ssl, /ssl, none, /novalidate-cert/tls,/ssl/novalidate-cert,/novalidate-cert. Some of them fail immediately. Some other such as /notls or no command, take some time to fail)
Mime preference: HTML
Security: Disabled
Send error replies: Disabled
Cron processing: Disabled
The interesting thing is that when I try to connect to my email at work using imap, it works beautifully.
Any insight will be greatly appreciated.
Thank you.
Cristina
#49
#40 worked for me... added the /novalidate-cert/notls to the extra commands. Thanks!
#50
has anyone gotten this to work on MAMP?
#51
I've been using mailhandler as part of open atrium (6.x-1.7) and it was failing to connect to an internal exchange 2007 server (using pop3 or IMAP)
I could manually telnet to host 110 / 143 and set it up to poll gmail remotely succesfully.
The only way I could get exchange 2007 to work was to add /notls as an extra command and it then worked fine
#52
Same as chrisred #51 - I am using a VPS with Plesk, standard set up and all I needed to do was add /notls to extra commands and it worked great. I am also using Open Atrium with it. Thanks chrisred.
#53
I was hopeful using the gmail config in msg#40, but I got the following error message...any suggestions?
* warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/novalidate-cert/notls}INBOX in /home/mysite/public_html/intra.cfbusiness.com/sites/all/modules/contrib/mailhandler/mailhandler.module on line 193.
* IMAP connection to myname@gmail.com failed.
#54
I am having a similar problem using POP. When I click "Retrieve" in the mailbox setup screen mail is retrieved correctly and nodes are created (though the emails aren't deleted even though I have ticked the relevant setting)
However when cron runs it gives these errors (in the log)
imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {NOTESSERVER:110/pop3}INBOX in D:\wamp\www\sites\all\modules\mailhandler\mailhandler.module on line 193.imap_close(): supplied argument is not a valid imap resource in D:\wamp\www\sites\all\modules\mailhandler\mailhandler.retrieve.inc on line 621.Why does it work when I do it manually but not when cron does it?
I am connecting to an internal Lotus Notes Domino server so issues surrounding Gmail shouldn't be affecting me here
#55
I was having difficulty getting this to work on my google apps accounts. I kept getting the "can't open stream" error. After trying to connect using just imap_open, I discovered the real problem was this error:
After some googling I found the answer. Google locks accounts if they are accessed to often or I think when they are new. You have to login to the web and to unlock it:
you may need to clear and unlock the CAPTCHA. To unlock CAPTCHA for Gmail account, go to the following URL:
https://www.google.com/accounts/DisplayUnlockCaptcha
Note: For Google Apps user, visit https://www.google.com/a/yourdomain.com/UnlockCaptcha instead, with yourdomain.com as the valid domain name.
I got this info here:
http://www.mydigitallife.info/2008/11/05/fix-gmail-imap-invalid-credenti...
I blogged about it here
http://bit.ly/UJVJj
Hope this helps!