I have a CRUD "clientes" and I added a button "email", when I click on it I would like to send an email with a username and a password
here is my button
$crud->add_action('Email', '', 'pendientes/pendientes_v/enviarmail', 'ui-icon-plus');
and then the function in my controller
function copyrows($id)
{
$this->load->model('cliente_model', 'client');
$clientInfo = $this->client->getInfo($client_id);
$this->email->from('[email protected]', 'Demo');
$this->email->to($clientInfo['email']);
$this->email->subject('Email Test');
$this->email->message('Hola tu usuario es ' . $clientInfo['email'] . ' y tu contraseƱa es ' . $clientInfo['clave']);
$this->email->send();
echo $this->email->print_debugger();
}
my model cliente_model.php
<?php
class Cliente_Model extends CI_Model{
public function getInfo($client_id){
return array('id' => $cliente_id,'email' => $email,'clave' => $clave);
}
}
here the errors
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method. From: "Demo" Return-Path: Reply-To: "[email protected]" X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit =?utf-8?Q?Email_Test?= Hola tu usuario es y tu contraseƱa [email protected]>@gmail.com>@gmail.com>
A PHP Error was encountered Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/oscar/public_html/crud/system/core/Exceptions.php:185)
Filename: core/Common.php
Line Number: 438
I know I am receiving a null value but I can't find the solution, hope someone can help me. thanks in advance!