The email function in email_model just retrieve data upon given email_name
what do you need is to send mail through mail class as Mudshark mentioned
you need to create a function at your controller , it'll be like this :
function sendMail($sender_email, $sender_name, $target_email, $subject, $message_data) {
$this -> load -> library('email');
// whatever email you want it to be as a sender
//just make sure it end with your domain name to not get blocked
// ex : '[email protected]','Support'
$this -> email -> from($email, $sender);
$this -> email -> to($target_email);//the email you're targeting
$this -> email -> subject($subject); // message subject
$message = "This is message data : ". $message_data;
$this -> email -> message($message); // message body as plain text
$this -> email -> send();
}
you could use more advanced options though like sending mail as html , by creating a view message.php with designed html for your email message and parsing an array of data to it.
your function would be like this :
function sendMail($sender_email, $sender_name, $target_email, $subject, $message_data) {
$this -> load -> library('email');
$config['mailtype'] = 'html';
$this -> email -> initialize($config); // to define email as html type
$this -> email -> from($email, $sender);
$this -> email -> to($target_email);//the email you're targeting
$this -> email -> subject($subject); // message subject
$this->email->message( $this->load->view( 'message', $message_data, true )); //html message
$this -> email -> send();
}