CodeIgniter Forums
$this->email->send() returns nothing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: $this->email->send() returns nothing (/thread-54472.html)

Pages: 1 2


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]redcloud80[/eluser]
Why $this->email->send() returns nothing (blank html)?

Code:
public function __construct()
{
  parent::__construct();
  $this->load->library('email');
}

public function send_confirmation_email()
{
  $user_email =  '[email protected]';
  
  $this->email->from('[email protected]', 'ttt');
  $this->email->to($user_email);
  $this->email->subject('Registration confirmation');
  $this->email->message('Please click this link to confirm your registration ');
  
  die($this->email->send());
}

This is my email.php config file

Code:
$config['protocol'] = 'smtp';
$config['charset'] = 'iso-8859-1';//'utf-8';
$config['mailtype'] = 'text';

$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'mypass';
$config['smtp_port'] = 465;
$config['smtp_timeout'] = 5;

Any idea?


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]TWP Marketing[/eluser]
die() stops execution of the script.
It can't return anything.


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]redcloud80[/eluser]
Sure, but it should print at least TRUE or FALSE, according send() documentation.


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]TWP Marketing[/eluser]
Try this:
$result = $this->email->send();
die('The result is: '.$result);


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]redcloud80[/eluser]
The output: "The result is: "


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]CroNiX[/eluser]
Code:
die($this->email->print_debugger());



$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]redcloud80[/eluser]
An empty pre...

Code:
<pre>

</pre>



$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]CroNiX[/eluser]
[quote author="redcloud80" date="1347306335"]Sure, but it should print at least TRUE or FALSE, according send() documentation.[/quote]
it does if you use var_dump($var), since it's a boolean and not a string it won't print "true/false" to the screen...


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]redcloud80[/eluser]
[quote author="CroNiX" date="1347312562"][quote author="redcloud80" date="1347306335"]Sure, but it should print at least TRUE or FALSE, according send() documentation.[/quote]
it does if you use var_dump($var), since it's a boolean and not a string it won't print "true/false" to the screen...[/quote]
Correct. It returns boolean FALSE. Where I can find some log files about this?


$this->email->send() returns nothing - El Forum - 09-10-2012

[eluser]CroNiX[/eluser]
I don't see where you initialize your email with the $config. You only define the $config.
Code:
$this->email->initialize($config);
Sounds like you need to check your mail server error logs...