0

I have got business email package with bigrock and was able to work with it since last 2 months but suddenly since last two days, it is throwing the error.

"Failed to connect to smtp.indianvisaservice.org.in:587 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]"

I am not sure what is this, here is the code

    <?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.";
 }

?>

What i am doing wrong here, Any support will be thankful.

Synchro
  • 35,538
  • 15
  • 81
  • 104
  • Use Port 465 for ssl connections and 587 for tls connections – ivion Nov 21 '18 at 11:40
  • i have tried with 465 , but still same issue. – Ojibix Creatives Nov 21 '18 at 11:42
  • And if you use 587 and socket options 'tls' – ivion Nov 21 '18 at 11:43
  • If you fail to connect with the connection timing out you can simply not reach your destination server on your destination port. Some kind of network related issue. First verify you can reach the destination server on the destination port just by seeing if you with a more generic tool can at least connect to the port from the same machine. If you can't, this has nothing to do with your code. – DanielBarbarian Nov 21 '18 at 11:49
  • Disabling certificate verification is a very bad idea; fix security issues properly. – Synchro Nov 22 '18 at 10:15

0 Answers0