Welcome Guest, Not a member yet? Register   Sign In
email not sending
#1

public function index()
{
//$this->load->view('welcome_message');
$config = Array(
'protocol'=> 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '********@gmail.com',
'smtp_pass' => '********'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('*******@gmail.com','kvr');
$this->email->to('******@gmail.com');
$this->email->subject('test mail');
$this->email->message('working');

$path = $this->config->item('server_root');
//echo $path;
//die();

if($this->email->send())
{
echo 'mail sent';
}
else
{
show_error($this->email->print_debugger());
}
}


I got error
*********

1,Message: fsockopen(): SSL: Handshake timed out
2,Message: fsockopen(): Failed to enable crypto
3,Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)
4, 
The following SMTP error was encountered: 110 Connection timed out

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

guys help me to solve my problem 
Reply
#2

This is wrong.

PHP Code:
$this->load->library('email',$config); 

Should be some thing like this

PHP Code:
$this->load->library('email');

// see the User's Guide for setting these.
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;

$this->email->initialize($config); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 08-04-2018, 03:38 AM by kvanaraj.)

(08-04-2018, 02:58 AM)InsiteFX Wrote: This is wrong.

PHP Code:
$this->load->library('email',$config); 

Should be some thing like this

PHP Code:
$this->load->library('email');

// see the User's Guide for setting these.
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;

$this->email->initialize($config); 

An Error Was Encountered

Exit status code: 1
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.


public function index()

{

//$this->load->view('welcome_message');

/*$config = array(

'protocol'=> 'smtp',

'smtp_host' => 'ssl://smtp.googlemail.com',

'smtp_port' => 465,

'driver' => 'sendmail',

'smtp_user' => '***@gmail.com',

'smtp_pass' => '*****'

);*/



//$this->load->library('email',$config);

$this->load->library('email');

$config['protocol'] = 'sendmail';

$config['mailpath'] = '/usr/sbin/sendmail';

$config['charset'] = 'iso-8859-1';

$config['wordwrap'] = TRUE;



$this->email->initialize($config); 



$this->email->set_newline("\r\n");

$this->email->from('*****@gmail.com','kvr');

$this->email->to('****@gmail.com');

$this->email->subject('test mail');

$this->email->message('working');



$path = $this->config->item('server_root');

//echo $path;

//die();



if($this->email->send())

{

echo 'mail sent';

}

else

{

show_error($this->email->print_debugger());
}


Attached Files
.php   Email.php (Size: 56.27 KB / Downloads: 109)
Reply
#4

(This post was last modified: 08-04-2018, 10:56 PM by Paradinight.)

(08-03-2018, 11:31 PM)kvanaraj Wrote: public function index()
{
//$this->load->view('welcome_message');
$config = Array(
'protocol'=> 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '********@gmail.com',
'smtp_pass' => '********'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('*******@gmail.com','kvr');
$this->email->to('******@gmail.com');
$this->email->subject('test mail');
$this->email->message('working');

$path = $this->config->item('server_root');
//echo $path;
//die();

if($this->email->send())
{
echo 'mail sent';
}
else
{
show_error($this->email->print_debugger());
}
}


I got error
*********

1,Message: fsockopen(): SSL: Handshake timed out
2,Message: fsockopen(): Failed to enable crypto
3,Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)
4, 
The following SMTP error was encountered: 110 Connection timed out

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

guys help me to solve my problem 
You config is a little bit wrong:
ssl://smtp.googlemail.com to smtp.googlemail.com
Add 'smtp_crypto' => 'ssl' to the config array
Reply
#5

(08-04-2018, 10:56 PM)Paradinight Wrote:
(08-03-2018, 11:31 PM)kvanaraj Wrote: public function index()
{
//$this->load->view('welcome_message');
$config = Array(
'protocol'=> 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '********@gmail.com',
'smtp_pass' => '********'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('*******@gmail.com','kvr');
$this->email->to('******@gmail.com');
$this->email->subject('test mail');
$this->email->message('working');

$path = $this->config->item('server_root');
//echo $path;
//die();

if($this->email->send())
{
echo 'mail sent';
}
else
{
show_error($this->email->print_debugger());
}
}


I got error
*********

1,Message: fsockopen(): SSL: Handshake timed out
2,Message: fsockopen(): Failed to enable crypto
3,Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)
4, 
The following SMTP error was encountered: 110 Connection timed out

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

guys help me to solve my problem 
You config is a little bit wrong:
ssl://smtp.googlemail.com to smtp.googlemail.com
Add 'smtp_crypto' => 'ssl' to the config array

Finally i got solution. my network block this . in my home it's working well. how to unblock from network
Reply
#6

You would need to edit your network config to allow that port number through it.

It depends on the network your running of which file to edit.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB