SMTP电子邮件无法连接套接字错误

时间:2018-11-21 11:34:08

标签: php smtp pear-mail

我有使用bigrock的商务电子邮件程序包,并且从最近两个月开始就可以使用它,但是从最近两天开始,突然出现了错误。

  

“无法连接到smtp.indianvisaservice.org.in:587 [SMTP:连接套接字失败:连接超时(代码:-1,响应:)]”

我不确定这是什么,这是代码

    <?php

require_once "Mail.php";

$htmlcontent = "Hi, How are you?";

$host = "smtp.indianvisaservice.org.in";
$port = "587";
$username = "support@indianvisaservice.org.in";
$password = "somepassword";
$replyto = "support@indianvisaservice.org";

$to = "imthegrv@gmail.com";
$subject = "Complete Your e-Visa Application-".$appid."";

$from = "support@indianvisaservice.org.in";
$headers = array ('From' => $from,
  'To' => $to,
  'Reply-To' => $replyto, 
  'Subject' => $subject,
  'MIME-Version' => '1.0',
  'Content-Type' => "text/html; charset=ISO-8859-1");

$smtp = Mail::factory('smtp',
    array ('host' => $host,
           'port' => $port,
           'auth' => true,
           'socket_options' => array('ssl' => array('verify_peer_name' => false)),
           'username' => $username,
           'password' => $password));

$recipients = $to;

$mail = $smtp->send($recipients, $headers, $htmlContent);    

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
 } else {
  echo "Sent Successfully.";
 }

?>

我在这里做错了,任何支持将不胜感激。

0 个答案:

没有答案