CodeIgniter Forums
email not sending - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: email not sending (/showthread.php?tid=71355)



email not sending - kvanaraj - 08-03-2018

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 


RE: email not sending - InsiteFX - 08-04-2018

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); 



RE: email not sending - kvanaraj - 08-04-2018

(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());
}



RE: email not sending - Paradinight - 08-04-2018

(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


RE: email not sending - kvanaraj - 08-05-2018

(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


RE: email not sending - InsiteFX - 08-07-2018

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.