[英]SMTP connect() failed
SMTP connect() failed error on my php code. 我的php代码上的SMTP connect()失败错误。
I already referred all solutions in the stack overflow but nothing will work on my code 我已经在堆栈溢出中引用了所有解决方案,但是对我的代码没有任何作用
I am using php, mysql and server version 5.1.30 我正在使用php,mysql和服务器版本5.1.30
No message send to the recipient address. 没有消息发送到收件人地址。
I already uncomment the below line 我已经取消注释以下行
extension=php_openssl.dll
php_openssl.dll file exists in the ext folder. ext文件夹中存在php_openssl.dll文件。
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 to this 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 as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the 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 is always displayed. 始终显示未加载的ssl。 Is there is any solution to solve this error
是否有解决此错误的解决方案
my php.ini file
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 25
; For Win32 only.
sendmail_from = jansiantony92@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path ="\"C:\xampp\sendmail\sendmail.exe\" -t -i"
You need to open the debug; 您需要打开调试; you will be able to see the details of the error message;
您将能够看到错误消息的详细信息;
$mail->SMTPDebug = 3;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.