Having trouble with PHPMailer

后端 未结 7 1000
渐次进展
渐次进展 2020-11-28 09:24

I am trying to use PHPMailer to send a gmail email. I followed this post

In order to do this, I set up a function shown below:

function sendEmail($         


        
相关标签:
7条回答
  • 2020-11-28 10:18

    In such kinds of issues it is important to check how it runs on development environment before you deploy to production, since there are many server issues that might be related to the problem.

    Because of that before anything set debug to true and check the messages you get.

    $mail->SMTPDebug = 1;
    

    That said, common server issues in such situations are the following.

    1. Lack of SSL support in PHP. You must enable it.

    2. Some kind of firewall might be blocking you from connecting to outbound sockets. You can check that using PHP.

    -

    $p = fsockopen( '127.0.0.1', <port number>, $errno, $errstr, 5 );
    if ( !$p )
        // port is closed or blocked
    else
        // port is open and available
        fclose( $p );`
    
    0 讨论(0)
提交回复
热议问题