Workaround for PHP IMAP functions? Trying to work with incoming email on localhost using XAMPP

前端 未结 1 1760
醉酒成梦
醉酒成梦 2021-01-07 03:16

In the project I am working on right now, I am trying to add the functionality where I can change the status of a ticket from \'closed\' to \'reopened\' when the user sends

相关标签:
1条回答
  • 2021-01-07 03:50

    You probably have a firewall that blocks outgoing TCP packets going to imap.gmail.com on port 993.

    Ask your sysadmin to check for outgoing TCP on dport 993 (imaps). Also check if your DNS is resolving imap.gmail.com:

    The command:

    telnet imap.gmail.com 993
    

    should give you a valid connection. If it doesn't succeed you found the problem.

    You may want to install a IMAP server on your development machine so to continue the development offline... you can install "courier imap" package but it's not a very simple task...

    If the connection succeded and the command:

    openssl s_client -connect imap.gmail.com:993
    

    give you a valid connection, the problem could be that your libc-client doesn't have SSL support compiled in. In this case you cannot use imaps with PHP, and you could use the "stunnel" command to forward clear traffic originating on your local machine going encrypted to gmail IMAP servers.

    The command:

    stunnel -c -d 127.0.0.1:443 -r imap.gmail.com:993
    

    should do the trick. This way you can connect your PHP script to 127.0.0.1:443:

    <?
      $connect = "{localhost:443}INBOX";
    ?>
    
    0 讨论(0)
提交回复
热议问题