I want to use the webmail module for my website but i cant able to configure my mail server with it. It gives me the error that "Couldn't open stream {mail.mydomain.com:143}". I have configured it by reading the documentation given for webmail - http://drupal.org/node/369604 . My mail server given in the cpanel webmail option is mail.mydomain.com
The following settings I have done:
Mail API:
Protocol:IMAPWU
1. Server Hostname: mail.mydomain.com
2. Server Port: 143
3. Encryption: none
4. Domain: mydomain.com
5. Connection options: {removed all settings written there, means field is blanked}
6. Login Suffix: @mydomain.com or +mydomain.com (tried both)

Webmail plus:
1. Mail Connection:mydomain.com
2. Mail delivery:
Mail Connection:SMTP
SMTP host:mail.mydomain.com
SMTP port:25
Encryption:None
Username:pankaj
password: {My password which i m using for opening may email pankaj@mydomain.com }
3. Authentication:User defined email password
4. Debugging Settings: Enabled

All other settings which i haven't described are left as default.
I am using drupal-6.10 version and php-5.2.8 having =>IMAP c-Client Version:2006k, SSL Support:enabled, Kerberos Support:enabled.
I have also installed the all required modules for webmail modules.
When i go in the My accounts tab the error comes that -could't open stream. Could anyone please tell what is the problem ?

Comments

pankajshr_jpr’s picture

Error i m getting is :

warning: imap_open() [function.imap-open]: Couldn't open stream {mail.visvas.org:143}INBOX in /home/visvas/public_html/campus-compass/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 66.
warning: imap_status(): supplied argument is not a valid imap resource in /home/visvas/public_html/campus-compass/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 86.
warning: imap_check(): supplied argument is not a valid imap resource in /home/visvas/public_html/campus-compass/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 172.
warning: imap_fetch_overview(): supplied argument is not a valid imap resource in /home/visvas/public_html/campus-compass/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 158.
Your email password is not correct. Please click here to set it.

The password for accessing the mail is correct. I can access mail account by cpanel using this password.
what is the problem?

juanito’s picture

My problem scenario:
Webmail Plus
password: (password for mail john@example.com)
Drupal user config
username: mr_jones
My account mail: john@example.com

Here was the problem.

Webmail plus was trying to login as mr_jones@example.com (apparently thats how it works, I was confused thinking it would use the drupal user mail configuration).

I changed drupal username to john and problem resolved.

But not everething went fine. It displayed me the mails but when I try to read them I get this.

Fatal error: Call to undefined function webmail_plus_connect() in ....\webmail_plus.thread_view.inc on line 50

I hope it helps

juanito’s picture

I am talking to myself in the way to get webmail plus working I found that apparently these function was beeing called with an old name and the actual function is called : _webmail_plus_connect() so I edited webmail_plus.thread_view.inc and after renaming 3 or 4 different calls to some functions and adding _ prefix I could finally solve the problem.

But not everithing is so shinny.

I get to the message and I cannot see the body, this error:

warning: imap_body() [function.imap-body]: Bad message number in ..\imapwu_api\imapwu_api.module on line 191.

------------
I managed to print the message number and it has nothing to do with the real message number though the url has the message number partly correct eg. if the message is number 12 the URL has http://.../INBOX%412 I forced the number and it displayed it correcly and looking at the other messages, at least in mi case, I get to think that it is a pattern. So for what's left of work I'll try to see where is the url generated and manupulate that variable un the impawu_api.module.

juanito’s picture

There are some problems/ confusions with Message Number and Message UID
Problem Solved as follows:

on line 191
replace
$rs = imap_body($_imapwu_api_connection, $msg_number, $options);
with
$real_msgnum=imap_msgno ( $_imapwu_api_connection, $msg_number);
$rs = imap_body($_imapwu_api_connection, $real_msgnum, $options);

I hope this is usefull for other it took me some reading.

If someone can help with display of blocks and folders, I will appreciate that!!

pankajshr_jpr’s picture

Hi juanito,
I have done all the things you have described above :changed username, modified the impawu_api.module, webmail_plus.functions.inc, webmail_plus.view_folder.inc files as described but still getting the same error

I am talking to myself in the way to get webmail plus working I found that apparently these function was beeing called with an old name and the actual function is called : _webmail_plus_connect() so I edited webmail_plus.thread_view.inc and after renaming 3 or 4 different calls to some functions and adding _ prefix I could finally solve the problem.

could you tell what you have done exactly?

okaydave’s picture

I have followed all the above instructions and I can now use it Webmail Plus, but whenever I access my inbox I get the error message:

user warning: Duplicate entry '13-1-INBOX-219' for key 1 query: INSERT INTO webmail_plus_user_threads_map(tid,uid,folder,message_uid) VALUES(13, 1, 'INBOX', 219) in .../modules/webmail_plus/webmail_plus.module on line 1566

This mesage is repeated several times for a number of duplicate entries with different numbers, going down to '452-1-INBOX-712'.

I'm no expert; any ideas?

I've been waiting for a good webmail module for Drupal for about 2 years. Looks like it's finally here!

juanito’s picture

Read carefully:

I don't think it's the best solution, but until a this bugs are patched by webmail_plus devs, I did some code mods so that I can use it.

 

For duplicated entries

File: webmail_plus.functions.inc

Find:

foreach($mailboxes as $mailbox_id => $mailbox_name) {

Replace :

 if ($mailbox_name=="") continue;
        db_query("INSERT INTO {webmail_plus_user_folders}(uid,folder) VALUES(%d,'%s')", $user->uid, $mailbox_name);

With:

  if ($mailbox_name=="") 
                {
		db_query("INSERT INTO {webmail_plus_user_folders}(uid,folder) VALUES(%d,'%s')", $user->uid, $mailbox_name);
		}
		else
		{
		$results = db_query("SELECT folder FROM {webmail_plus_user_folders} WHERE uid='%d' AND folder='%s'", $user->uid,$mailbox_name);
  		$folder = db_fetch_array($results);
		if ($folder['folder']!=$mailbox_name)
			{
			db_query("INSERT INTO {webmail_plus_user_folders}(uid,folder) VALUES(%d,'%s')", $user->uid, $mailbox_name);
			}			
		}

I Also solved for my implementation de folders problem where folders appear as {host:port}INBOX.folder
By adding a function that cleans folder name string for output.

For 'move to' option values and folder block listing

File: webmail_plus.functions.inc (I Added it at the top)

Find:

<?php

Add after:

function webmail_plus_clean_folder_name($str)
	{
	$pos=(strpos($str,'}'));
	if ($pos)
		{
		$pos++;
		$pos2=(strpos($str,'.',$pos));
		if ($pos2)
			{
			$pos2++;
			$str=substr($str,$pos2,(strlen($str)-$pos2));
			}					
		else
			{
			$str=substr($str,$pos,(strlen($str)-$pos));
			}
		}
	return $str;
	}

For folder block listing

File: webmail_plus.functions.inc

Find:

   // set the session to true
    $_SESSION['webmail_plus']['folders_loaded']=TRUE;
  }

Add after:

  foreach($output as $folder_name=>$folder_junk) {
    	$output[$folder_name]=t(webmail_plus_clean_folder_name($folder_name));
    }

For move to option values

File: webmail_plus.view_folder.inc
Replaced:

  $options['move_to_'.$mailbox_name] = t('Move to').' '.$mailbox_name;

With:

  $options['move_to_'.$mailbox_name] = t('Move to').' '.webmail_plus_clean_folder_name($mailbox_name);
pankajshr_jpr’s picture

I have done all the things you have described above :changed username, modified the impawu_api.module, webmail_plus.functions.inc, webmail_plus.view_folder.inc files as described but still getting the same error

* warning: imap_open() [function.imap-open]: Couldn't open stream {mail.visvas.org:143}INBOX in /home/visvas/public_html/eboard/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 73.
* warning: imap_status(): supplied argument is not a valid imap resource in /home/visvas/public_html/eboard/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 93.
* warning: imap_check(): supplied argument is not a valid imap resource in /home/visvas/public_html/eboard/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 179.
* warning: imap_fetch_overview(): supplied argument is not a valid imap resource in /home/visvas/public_html/eboard/sites/default/modules/mail_api/contrib/imapwu_api/imapwu_api.module on line 165.

any ideas?

loginsvariaditos’s picture

At least it worked for me:

I changed the MAIL.API config to:
* Folder prefix: to your mail server. Mine, in localhost, with XAMPP "D:\XAMPP\MercuryMail\MAIL"
* Take off the Connection options parameter

Changes in WEBMAIL_PLUS:
* Mail Delivery: SMTP, port 25 (default)
* Authentication: Internal (Change it cause default is nothing).

And... what solved all my problems: DON´T FORGET TO CONFIG THE AES.MODULE!!
Config:
* Default, and I changed the Key storage method to File.
* Path to file YOUR_SITE\sites\default\files\aes.key (maybe is not the safest way but this is a testing site).
No need to insert key: You normally don't need to worry about this since this module will generate a key for you if none is specified. However...

And it works! Now I have a problem, because the To: field composing a mail, has a valid mails filter, and I cannot send mails to XXX@localhost. It says its not a valid domain. The [dot]whatever missing??

weizrd’s picture

still getting those 4 errors loginsvariaditos solved

on my cpanel, it tells me this:
Mail Server Username: my.name+sscr.ro
Incoming Mail Server: mail.sscr.ro
Incoming Mail Server: (SSL) ro4.globehosting.net
Outgoing Mail Server: mail.sscr.ro (server requires authentication) port 26
Outgoing Mail Server: (SSL) ro4.globehosting.net (server requires authentication) port 465
Supported Incoming Mail Protocols: POP3, POP3S (SSL/TLS), IMAP, IMAPS (SSL/TLS)
Supported Outgoing Mail Protocols: SMTP, SMTPS (SSL/TLS)
* Mac Mail IMAP Note: The "IMAP Path Prefix" needs to be set to INBOX otherwise Mail.app will not be able to store deleted, draft or sent mail on the server. click for more info

so, in mail.api i used what i had noticed in the files of automatic configurations downloaded from cpanel
hostname: mail.sscr.ro
port: 26
no encription
prefix: INBOX (also added to those folders)
removed connection

in webmail:
mail delivery: smtp, mail.sscr.ro, port 25 (not 26), no encription, authent: internal

tried a few hours different combinations i could imagine. (anyway: general question to see if it's worth: any of my users in the website which have emails on the server will be able to check their email through the website, right? - luckily, the usernames on drupal are all the same like on the email, except for me, the admin)

any help is greatly appreciated
thank you

loginsvariaditos’s picture

could you publish some screenshots of the config?

weizrd’s picture

forgot to say about AES. at first, when i posted my message, i didn't had it enabled. Then, i enabled it and configured it just how you said and all worked smoothly about it. key was there and everything. however, i still have the errors..

so, screenshots (couldn't upload them here - filtered html):
http://img23.imageshack.us/gal.php?g=picture1tng.png
or http://yfrog.com/0npicture1tngpx

you have in order:
* screenshots from update with all my modules installed (probably not relevant)
* mail api config (starting with picture21.png -scroll down)
* webmail plus config
* cpanel info
* errors after flushed the caches, cron and update..

please tell me: does it work for all the email users on the website? as performance decreases dramatically when I enable webmailplus.

Thank you

loginsvariaditos’s picture

I have been really busy this days. I´ll look at it as soon as possible!
I also have some problems with the folders config. I think my problem is related to Windows Vista folders permissions, in my localhost hosting.
I´ll tell you something asap.

weizrd’s picture

pankajshr_jpr’s picture

I have got some errors about configuring the weight of webmail, file and file_attach modules during installation: http://drupal.org/node/493514

may it cause the connection error?

Canine Coaches’s picture

I did not have luck with the code from that post you mentioned, but the utility module (I htink) works great and makes it easier for administering modules. Search drupal for "utility module weight"

edit: If you are still working with this use /novalidate-cert as an "extra command" to login to your imap server. This was the only way I could do it in mail api 6.1.7

Chris

gumrol’s picture

Am I smoking pot, or is Webmail Plus supposed to create the Email account on the Email server, when a user signs up?

I've gotten it to work (Webmail Plus version 6.x.1.16) with an existing email account only: thanks all for your great help on this forum.

Now I need the last step in the process, when a user registers, Webmail + needs to create the Email account, so that new users can get email if they want it. Anyone done this, or is Webmail supposed to do it & mine's not functioning 100%?

Thanks in advance.

gumrol’s picture

I have to connect to Posfix on Creation of Drupal User & insert the user into the database... Webmail Plus is giving endless issues for us. The latest issues are:
Email deletion is not possible
Sending attachments is not possible
Email folders are not visible, other than inbox, but oddly, if one goes into Squirelmail for a postfix account, and then come back to Drupal & login there, voila - mail folders (Trash, Sent etc).

I think my imap connections are somehow limited to reading mail & sending. I don't know enough about imap and posfix to know where to start looking. My guess would be that somehow there are permissions limiting Webmail Plus on what it can do with its imap connection.

If anyone could steer me in the direction I should be looking in, that'd be great

Rory_Brooks’s picture

Hi i have spent a week trying to get webmail plus to work!

And am now finally where you are at...

I solved it by logging into squirrel mail and subscribing to the needed folders.

Users do not have an email address created for them upon registration, i have to

create one in cpanel,
then login to the user account, on the site
open cpanel webmail in another tab,
login with the user details,
subscribe to folders,

and that seems to fix it.

Still cant send mail though, but almost have it figured out... i hope!

Maybe

http://drupal.org/project/cpanel_ops

Might solve the email creation problem, busy investigating now...

I was beginning to think i would never get it right, now there is hope!