Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IMAP on Mailtrust 1

Status
Not open for further replies.

lifelineamerica

Programmer
Aug 9, 2006
23
US
I have an account with Mailtrust.com. They are a popular email host.
I copied my parameters from a regular email client (ie outlook) where everything works fine.

$server = '{imap.emailsrvr.com:143}';
$mailbox = 'INBOX';
$username = 'me@mydomain.com';
$password = 'mypassword';
//connect to mailbox
$mbox = imap_open($server.$mailbox, $username, $password);
if ($mbox === false) {
die ('could not connect to mailbox');
}

...and of course I'm always getting the die message.
I know it must work somewhat because if I change the port to something else, it takes forever for the script to come back and tell me that it can't connect. However if the parameters are correct as above, the death message I get (could not connect to mailbox) is instantaneous. I also tried with and without the $mailbox parameter with no success.
 
Let me be clarify a little. I know that the server, port, user name, and password are definitely correct, and php.ini reads "with IMAP". But I still cannot successfully connect to the IMAP server using imap_open. Is there any other thing that I may still be missing?
 
specify the debug switch and see what info you get back.
and also query the imap_last_error() instead of just exiting.
and assuming you are using php >=5.2.2 you will need to specify the notls switch for unencrypted connections (on windows at least)
Code:
$server = '{imap.emailsrvr.com:143}';
$switches = '/imap/notls/debug';
$mailbox = 'INBOX';
$username = 'me@mydomain.com';
$password = 'mypassword';
//connect to mailbox
$mbox = imap_open($server.$mailbox, $username, $password);
if ($mbox === false) {
die ('could not connect to mailbox ' . imap_last_error() );
}
 
oops

Code:
$server = 'imap.emailsrvr.com:143';
$switches = '/imap/notls/debug';
$mailbox = 'INBOX';
$username = 'me@mydomain.com';
$password = 'mypassword';
//connect to mailbox
$mbox = imap_open("{".$server.$switches."}".$mailbox, $username, $password);
if ($mbox === false) {
die ('could not connect to mailbox ' . imap_last_error() );
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top