php - SMTP connect() failed -


smtp connect() failed error on php code.

i referred solutions in stack overflow nothing work on code

i using php, mysql , server version 5.1.30

no message send recipient address.

i uncomment below line

extension=php_openssl.dll 

php_openssl.dll file exists in ext folder.

email.php  <?php  include "phpmailer-master/class.phpmailer.php"; include "phpmailer-master/class.smtp.php"; $mail = new phpmailer();  $mail->issmtp(); // send via smtp  $mail->smtpauth = true; // turn on smtp authentication $mail->host = "smtp.gmail.com"; $mail->port = 465; echo !extension_loaded('openssl')?"not available":"available"; $mail->username = "jansiantony92@gmail.com"; // smtp username $mail->password = "xxxxxxxxx"; // smtp password $webmaster_email = "asha.it33@gmail.com"; //reply email id $email="aasha.vkm@domain.com"; // recipients email id $name="name"; // recipient's name $mail->from = $webmaster_email; $mail->fromname = "webmaster"; $mail->addaddress($email,$name); $mail->addreplyto($webmaster_email,"webmaster"); $mail->wordwrap = 50; // set word wrap //$mail->addattachment("/var/tmp/file.tar.gz"); // attachment //$mail->addattachment("/tmp/image.jpg", "new.jpg"); // attachment $mail->ishtml(true); // send html $mail->subject = "this subject"; $mail->body = "hi, html body "; //html body $mail->altbody = "this body when user views in plain text format"; //text body if(!$mail->send()) { echo "mailer error: " . $mail->errorinfo; } else { echo "message has been sent"; } ?> 

ssl not loaded displayed. there solution solve error

my php.ini file  [mail function] ; win32 only. smtp = smtp.gmail.com smtp_port = 25  ; win32 only. sendmail_from = jansiantony92@gmail.com  ; unix only.  may supply arguments (default: "sendmail -t -i"). ;sendmail_path ="\"c:\xampp\sendmail\sendmail.exe\" -t -i" 

you need open debug; able see details of error message;

$mail->smtpdebug = 3;  

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -