PHP imap configuration info?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Krik
    Junior Member
    • Jan 2012
    • 5

    PHP imap configuration info?

    I am trying to integrate an email client into a web app so the admins for a site don't have to login to two different places (too confusing for them). I am unable to get my code to connect to the mail servers even though my code is able to access Gmail, Yahoo, AOL, ect. I use Thunderbird for my personal email client, so the information it has on the server configuration as well as the information that is provided for using an email client I think would be enough to configure my imap code, but I am getting errors no matter how I configure it.

    Here's my code, in the comments I have listed many of the variations I have tried for the "$hostname" (domain name email address and password were change for posting here).
    PHP Code:
    // $hostname = '{mail.mydomain.com:143/imap}INBOX';
    // $hostname = '{mail.mydomain.com:143/pop3}INBOX';
    // $hostname = '{mail.mydomain.com:143/imap/notls}INBOX';
    // $hostname = '{mail.mydomain.com:143/pop3/notls}INBOX';
    // $hostname = '{mail.mydomain.com:143/imap/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/pop3/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/imap/notls/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/pop3/notls/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/imap/notls/norsh/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/pop3/notls/norsh/novalidate-cert}INBOX';
    // $hostname = '{mail.mydomain.com:143/imap}';
    // $hostname = '{mail.mydomain.com:143/pop3}';
    // $hostname = '{mail.mydomain.com:143/imap/notls}';
    // $hostname = '{mail.mydomain.com:143/pop3/notls}';
    // $hostname = '{mail.mydomain.com:143/imap/novalidate-cert}';
    // $hostname = '{mail.mydomain.com:143/pop3/novalidate-cert}';
    // $hostname = '{mail.mydomain.com:143/imap/notls/novalidate-cert}';
    // $hostname = '{mail.mydomain.com:143/pop3/notls/novalidate-cert}';
    // $hostname = '{mail.mydomain.com:143/imap/notls/norsh/novalidate-cert}';
    // $hostname = '{mail.mydomain.com:143/pop3/notls/norsh/novalidate-cert}';
    $hostname '{mail.mydomain.com:143}';
    $username 'email@mydomain.com';
    $password 'password';

    $mbox imap_open($hostname$username$password); 
    I am fairly certain I need either the "novalidate-cert" or "notls" flags because without one of them I get this error
    Certificate failure for mail.mydomain.com: Server name does not match certificate: SERIALNUMBER=0y5LL1cbrMRv1OcrTFzg/4/JzbmjaY9T, C=US, O=*.gzo.com, OU=GT97607460, OU=See www.rapidssl.com/resources/cps (c)11, OU=Domain Control Validated - RapidSSL(R), CN=*.gzo.com
    So with either the "novalidate-cert" or "notls" flag and using the "imap" flag I get this error no matter what other flags I use
    Notice: Unknown: [AUTHENTICATIONFAILED] Authentication failed. (errflg=1) in Unknown on line 0

    Notice: Unknown: [AUTHENTICATIONFAILED] Authentication failed. (errflg=1) in Unknown on line 0

    Notice: Unknown: [AUTHENTICATIONFAILED] Authentication failed. (errflg=1) in Unknown on line 0

    Notice: Unknown: Too many login failures (errflg=2) in Unknown on line 0
    And with the pop3 flag (and "novalidate-cert" or "notls") no matter what other flag I use I get this error
    Notice: Unknown: OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready. (errflg=2) in Unknown on line 0
    And of course with each of those I get an error similar to this, and of course all other imap functions fail as well
    Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.domain.com:143/imap/novalidate-cert}INBOX in ...
    I tried "email@mydomain.com", "email+mydomain.com" (per the email client configuration page) and "email" for the username, also double checked the password (logged in via webmail). So I must assume I don't have the "$hostname" configured correctly. So if anyone knows what I should set the "$hostname" to it would be greatly appreciated.
  • Krik
    Junior Member
    • Jan 2012
    • 5

    #2
    Nevermind. I had the wrong domain name. The account has multiple domain names and I had mixed up the TLD. Doh!?

    Comment

    • AndrewT
      Administrator
      • Mar 2004
      • 3653

      #3
      For the server you can also use your server's host name so that you can use SSL without disabling the validation.

      Comment

      Working...