Codeigniter : Unable to Send Email via SMTP Google always got Connection Refused
up vote
0
down vote
favorite
I am struggling in how to send email by using smtp gmail.
This error always happens to me,
[message:protected] => fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
[string:Exception:private] =>
[code:protected] => 2
[file:protected] => /home/u6676613/public_html/testing/system/libraries/Email.php
[line:protected] => 1689
[trace:Exception:private] => Array
Below is my configuration for sending the email
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.gmail.com' ;
$config['smtp_port']='465';
//$config['smtp_crypto'] = 'ssl';
$config['smtp_timeout']='30';
$config['smtp_user']=$smtp_username;
$config['smtp_pass']=$smtp_password;
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('do-not-reply@blabla.com');
$this->email->to($email);
$this->email->subject('Testing');
$this->email->message($msg);
if($this->email->send())
{
$this->success();
}
else
{
show_error($this->email->print_debugger());
}
If i try to uncomment smtp crypto, i got error " fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
FYI ssl extension already enabled.
Kindly need your help for this matter
My problem is not ssl extension related so i think its not duplicate with another issue
php codeigniter email smtp
add a comment |
up vote
0
down vote
favorite
I am struggling in how to send email by using smtp gmail.
This error always happens to me,
[message:protected] => fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
[string:Exception:private] =>
[code:protected] => 2
[file:protected] => /home/u6676613/public_html/testing/system/libraries/Email.php
[line:protected] => 1689
[trace:Exception:private] => Array
Below is my configuration for sending the email
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.gmail.com' ;
$config['smtp_port']='465';
//$config['smtp_crypto'] = 'ssl';
$config['smtp_timeout']='30';
$config['smtp_user']=$smtp_username;
$config['smtp_pass']=$smtp_password;
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('do-not-reply@blabla.com');
$this->email->to($email);
$this->email->subject('Testing');
$this->email->message($msg);
if($this->email->send())
{
$this->success();
}
else
{
show_error($this->email->print_debugger());
}
If i try to uncomment smtp crypto, i got error " fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
FYI ssl extension already enabled.
Kindly need your help for this matter
My problem is not ssl extension related so i think its not duplicate with another issue
php codeigniter email smtp
Try removingssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)
– p0358
Nov 18 at 21:32
uncomment smtp crypto and run in terminalsetsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am struggling in how to send email by using smtp gmail.
This error always happens to me,
[message:protected] => fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
[string:Exception:private] =>
[code:protected] => 2
[file:protected] => /home/u6676613/public_html/testing/system/libraries/Email.php
[line:protected] => 1689
[trace:Exception:private] => Array
Below is my configuration for sending the email
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.gmail.com' ;
$config['smtp_port']='465';
//$config['smtp_crypto'] = 'ssl';
$config['smtp_timeout']='30';
$config['smtp_user']=$smtp_username;
$config['smtp_pass']=$smtp_password;
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('do-not-reply@blabla.com');
$this->email->to($email);
$this->email->subject('Testing');
$this->email->message($msg);
if($this->email->send())
{
$this->success();
}
else
{
show_error($this->email->print_debugger());
}
If i try to uncomment smtp crypto, i got error " fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
FYI ssl extension already enabled.
Kindly need your help for this matter
My problem is not ssl extension related so i think its not duplicate with another issue
php codeigniter email smtp
I am struggling in how to send email by using smtp gmail.
This error always happens to me,
[message:protected] => fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
[string:Exception:private] =>
[code:protected] => 2
[file:protected] => /home/u6676613/public_html/testing/system/libraries/Email.php
[line:protected] => 1689
[trace:Exception:private] => Array
Below is my configuration for sending the email
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.gmail.com' ;
$config['smtp_port']='465';
//$config['smtp_crypto'] = 'ssl';
$config['smtp_timeout']='30';
$config['smtp_user']=$smtp_username;
$config['smtp_pass']=$smtp_password;
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$config['charset']='utf-8';
$config['newline']="rn";
$config['mailtype'] = 'html';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('do-not-reply@blabla.com');
$this->email->to($email);
$this->email->subject('Testing');
$this->email->message($msg);
if($this->email->send())
{
$this->success();
}
else
{
show_error($this->email->print_debugger());
}
If i try to uncomment smtp crypto, i got error " fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
FYI ssl extension already enabled.
Kindly need your help for this matter
My problem is not ssl extension related so i think its not duplicate with another issue
php codeigniter email smtp
php codeigniter email smtp
edited Nov 20 at 1:51
asked Nov 18 at 21:05
Shandy Kurnia
96
96
Try removingssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)
– p0358
Nov 18 at 21:32
uncomment smtp crypto and run in terminalsetsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34
add a comment |
Try removingssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)
– p0358
Nov 18 at 21:32
uncomment smtp crypto and run in terminalsetsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34
Try removing
ssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)– p0358
Nov 18 at 21:32
Try removing
ssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)– p0358
Nov 18 at 21:32
uncomment smtp crypto and run in terminal
setsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
uncomment smtp crypto and run in terminal
setsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
add a comment |
up vote
0
down vote
Check LESS SECURE APPSon your google account. By turning IT on, IT should work!
LESS SECURE APPS
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
add a comment |
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',
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%2f53365448%2fcodeigniter-unable-to-send-email-via-smtp-google-always-got-connection-refused%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
add a comment |
up vote
0
down vote
use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
add a comment |
up vote
0
down vote
up vote
0
down vote
use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.
use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.
answered Nov 19 at 6:51
Mac Rathod
215
215
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
add a comment |
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
sendinblue.com
– Mac Rathod
Nov 19 at 6:52
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
hmm i am planning using ci default email library
– Shandy Kurnia
Nov 19 at 16:06
add a comment |
up vote
0
down vote
Check LESS SECURE APPSon your google account. By turning IT on, IT should work!
LESS SECURE APPS
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
add a comment |
up vote
0
down vote
Check LESS SECURE APPSon your google account. By turning IT on, IT should work!
LESS SECURE APPS
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
add a comment |
up vote
0
down vote
up vote
0
down vote
Check LESS SECURE APPSon your google account. By turning IT on, IT should work!
LESS SECURE APPS
Check LESS SECURE APPSon your google account. By turning IT on, IT should work!
LESS SECURE APPS
answered Nov 19 at 6:59
KayaP
184
184
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
add a comment |
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
already done that, but still no luck
– Shandy Kurnia
Nov 19 at 16:04
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53365448%2fcodeigniter-unable-to-send-email-via-smtp-google-always-got-connection-refused%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
Try removing
ssl://
part from host parameter perhaps and see if it works (also uncomment smtp_crypto then)– p0358
Nov 18 at 21:32
uncomment smtp crypto and run in terminal
setsebool httpd_can_network_connect=1
– user969068
Nov 18 at 22:37
i've tried uncomment smtp crypto and remove ssl:// still got same error message "fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)"
– Shandy Kurnia
Nov 19 at 1:10
Possible duplicate of fsockopen(): unable to connect to ssl://smtp.gmail.com:465
– Twinkle
Nov 19 at 4:33
what do you mean by duplicate ? If im using another smtp server, it works. but if im using smtp google, i always get this error
– Shandy Kurnia
Nov 19 at 7:34