SMTP Email Failed to connect socket error
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.
php smtp pear-mail
add a comment |
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.
php smtp pear-mail
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
add a comment |
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.
php smtp pear-mail
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.
php smtp pear-mail
php smtp pear-mail
edited Nov 22 '18 at 10:14
Synchro
18.3k85371
18.3k85371
asked Nov 21 '18 at 11:34
Ojibix CreativesOjibix Creatives
367
367
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
add a comment |
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
Use Port 465 for ssl connections and 587 for tls connections
– ivion
Nov 21 '18 at 11:40
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
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
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
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
Disabling certificate verification is a very bad idea; fix security issues properly.
– Synchro
Nov 22 '18 at 10:15
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411210%2fsmtp-email-failed-to-connect-socket-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411210%2fsmtp-email-failed-to-connect-socket-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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