Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > PHP / MySQL Assistance
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

PHP / MySQL Assistance We understand. Not all of you are experienced programmers, but some of you are highly skilled at coding. So we've set aside this forum so you can ask questions, and provide answers to the most commonly asked PHP / MySQL issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-07-2008, 10:43 PM
Member
 
Join Date: Oct 2007
Location: MN
Posts: 33
Default IMAP Connection

Is it possible to make an IMAP connection to my mailbox? I've tried a few ways, but keep getting stumped.

Example below will return "Connection failed":
Code:
if(imap_open ("{mail.hostname.com/imap}Inbox",  $user, $pass))
  {echo 'Connection success!';}
else
  {echo 'Connection failed';}
As a side note, I am on a shared server, perhaps this is the problem?

Thanks for your time.

---

I did confirm w/ a trouble ticket (WMJ-875739) that the IMAP functions are available. Which leaves to believe it's something w/ the code?

Last edited by tzeench : 04-08-2008 at 09:18 AM. Reason: Update
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:33 AM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,700
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Quote:
Originally Posted by tzeench View Post
Is it possible to make an IMAP connection to my mailbox? I've tried a few ways, but keep getting stumped.

Example below will return "Connection failed":
Code:
if(imap_open ("{mail.hostname.com/imap}Inbox",  $user, $pass))
  {echo 'Connection success!';}
else
  {echo 'Connection failed';}
As a side note, I am on a shared server, perhaps this is the problem?

Thanks for your time.

---

I did confirm w/ a trouble ticket (WMJ-875739) that the IMAP functions are available. Which leaves to believe it's something w/ the code?
Im not a wiz when it comes to programming, but I've thought of a few things the above is leaving out:

1. The IMAP port #
2. How is the username, it should you your full email address
3. The host should be mail.yourdomain.com and thats alll (I believe)
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:41 AM
Member
 
Join Date: Oct 2007
Location: MN
Posts: 33
Default

Quote:
Originally Posted by lnxcode View Post
Im not a wiz when it comes to programming, but I've thought of a few things the above is leaving out:

1. The IMAP port #
2. How is the username, it should you your full email address
3. The host should be mail.yourdomain.com and thats alll (I believe)
I've also tried connecting to the SSL using the following code which does include the port number for the SSL connection:
Code:
<?php
if(imap_open ("{mail.mydomain.com:993/imap/ssl}Inbox",$user, $password"))
  {echo 'Connection success!';}
else
  {echo 'Connection failed';}
?>
I wasn't sure on what the port would be for the non-SSL connection, so if you know it, I'm willing to try that...

As for the how the user name is passed via a variable and I am using the entire email address for the user name (password is also passed via a variable):
Code:
<?php $user = "me@mydomain.com"; ?>
Thanks again!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 09:49 AM
Member
 
Join Date: Oct 2007
Location: MN
Posts: 33
Default

Got it!

Though I wasn't able to get it connect via SSL, but that really did not matter. It looks like I needed to pass the /notls parameter.

/notls - do not do start-TLS to encrypt the session, even with servers that support it

For you info here's the code that worked.

Code:
<?php
if(imap_open ("{mail.mydomain.com/imap/notls}Inbox", $user, $pass))
  {echo 'Connection success!';}
else
  {echo 'Connection failed';}
?>
Thanks for your input, it did help me discover this. Sometimes it just helps to talk it out to get the brain going.

Last edited by tzeench : 04-09-2008 at 01:50 PM.
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 12:37 PM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,700
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Hey,

You did all the hard work, glad I could help... not much of a programmer... :P
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

Copyright © 2003 - 2008 HostICan. All Rights Reserved.