gmail smtp not working in my hosting using codeigniter framework

后端 未结 2 1428
独厮守ぢ
独厮守ぢ 2020-12-16 21:02

i wish to use gmail smtp to send user information to the registered email.

The code that i am using is working fine in my localhost, but when i changed into shared ho

相关标签:
2条回答
  • 2020-12-16 21:16

    there is update for test script in newer php version:

    <?php
    
        $fp = fsockopen("www.google.com", 80, $errno, $errstr, 10); // work fine
        if (!$fp)
            echo "www.google.com -  $errstr   ($errno)<br>\n";
        else
            echo "www.google.com -  ok<br>\n";
    
    
        $fp = fsockopen("smtp.gmail.com", 465, $errno, $errstr, 10); // NOT work
        if (!$fp)
            echo "smtp.gmail.com 465  -  $errstr   ($errno)<br>\n";
        else
            echo "smtp.gmail.com 465 -  ok<br>\n";
    
    
        $fp = fsockopen("smtp.gmail.com", 587, $errno, $errstr, 10); // NOT work
        if (!$fp)
            echo "smtp.gmail.com 587  -  $errstr   ($errno)<br>\n";
        else
            echo "smtp.gmail.com 587 -  ok<br>\n";
    
    
    
    ?>
    
    0 讨论(0)
  • 2020-12-16 21:31

    Looks like ur ssl port in shared hosting is close, use this code to check if it is open.

    $fp = fsockopen("www.google.com", 80, &$errno, &$errstr, 10); // work fine
    if (!$fp)
        echo "www.google.com -  $errstr   ($errno)<br>\n";
    else
        echo "www.google.com -  ok<br>\n";
    
    
    $fp = fsockopen("smtp.gmail.com", 465, &$errno, &$errstr, 10); // NOT work
    if (!$fp)
        echo "smtp.gmail.com 465  -  $errstr   ($errno)<br>\n";
    else
        echo "smtp.gmail.com 465 -  ok<br>\n";
    
    
    $fp = fsockopen("smtp.gmail.com", 587, &$errno, &$errstr, 10); // NOT work
    if (!$fp)
        echo "smtp.gmail.com 587  -  $errstr   ($errno)<br>\n";
    else
        echo "smtp.gmail.com 587 -  ok<br>\n";
    
    0 讨论(0)
提交回复
热议问题