I have some problems, meaning that I don't receive mail from a form...
the code looks like this:
public function send_email(){
$this->load->library("form_validation");
$this->form_validation->set_rules("fullName", "Full Name", "required|alpha|xss_clean");
$this->form_validation->set_rules("email", "Email Address", "required|valid_email|xss_clean");
$this->form_validation->set_rules("message", "Message", "required|xss_clean");
if($this->form_validation->run() == FALSE){
$data["message"] = "";
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_comment", $data);
$this->load->view("site_footer");
}else{
$data["message"] = "The email was successfully been sent!";
$this->load->library("email");
$this->email->from(set_value("email"), set_value("fullName"));
$this->email->to("paulharbuz@gmail.com");
$this->email->subject("Message from our form");
$this->email->message(set_value("message"));
$this->email->send();
echo $this->email->print_debugger();
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_comment", $data);
$this->load->view("site_footer");
}
}
And i get an error that looks like this:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.**
Is this from my php.ini file?
i've set my files reading this part on http://php.net/manual/en/ref.mail.php
i found the solution: create a file in config: email.php that looks like this
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| EMAIL CONFING
| -------------------------------------------------------------------
| Configuration of outgoing mail server.
| */
$config['wordwrap'] = FALSE;
$config['mailtype'] = 'html';
$config['crlf'] = '\r\n';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['priority']=1;
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.googlemail.com';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='gcc.sandbox@gmail.com';
$config['smtp_pass']='qwaszx12';
$config['newline']="\r\n";
/* End of file email.php */
/* Location: ./system/application/config/email.php */
then load this in your main controller like: $this->email->initialize($this->config->config);
and that's it!