email - Problems with send mail using php -
somebody can me? need send email using php.
i using code send mail
<?php error_reporting(e_all); ini_set('display_errors', '1'); require '/phpmailer-master/phpmailerautoload.php'; error_reporting(e_all); ini_set('display_errors', '1'); echo (extension_loaded('openssl')?'ssl loaded':'ssl not loaded')."\n"; $mail = new phpmailer; $mail->smtpdebug = 2; // enable verbose debug output $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.gmail.com'; // specify main , backup smtp servers $mail->smtpauth = true; $mail->smtpdebug = true; // enable smtp authentication $mail->username = 'email@gmail.com'; // smtp username $mail->password = '******'; // smtp password $mail->smtpsecure = 'tls'; // enable tls encryption, `ssl` accepted $mail->port = 587; // tcp port connect $mail->from = $_post['email']; $mail->fromname = 'mailer'; $mail->addaddress('email@gmail.com', 'joe user'); $mail->ishtml(false); // set email format html $message = $_post['message']; $mail->subject = $_post['subject']; $mail->body = preg_replace('/\[\]/','',$message); $mail->altbody = 'this plain-text message body'; if(!$mail->send()) { echo 'message not sent.'; echo 'mailer error: ' . $mail->errorinfo; } else { echo 'message has been sent'; } ?>
the return this.
ssl loaded 2015-06-02 19:05:41 connection: opening smtp.gmail.com:465, timeout=300, options=array ( ) 2015-06-02 19:09:56 smtp error: failed connect server: network unreachable (101) 2015-06-02 19:09:56 smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting message not sent.mailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting
i using phpmailer. read https://github.com/phpmailer/phpmailer/wiki/troubleshooting, nothing change.
Comments
Post a Comment