I'm sure this is going to be a simple solution but when I use my codeigniter email form (i'm on local using xampp) it only sends emails when I enter my own email address in the form - which obviously I want people to enter their own. The whole thing stops working if I delete my email from the sendemail.ini auth_username section so I'm confident it's something to do with that. If I enter my own email in the form then it gets delivered fine. Any ideas what the issue is here?
My Controller
<?php
class Contact extends MX_Controller
{
function index() {
if (!isset($data['page_title'])) {
$data['page_title'] = 'Nail Care & Design in Stoke-on-Trent, Staffordshire';
}
if (!isset($data['keywords'])) {
$data['keywords'] = 'Nails, Weddings, Parties, Beauty, Nailcare';
}
if (!isset($data['description'])) {
$data['description'] = 'Nail Care & Design in Stoke-on-Trent, Staffordshire';
}
$data['query'] = $this->get_where(1);
$data['querytwo'] = $this->get('page_headline');
$data['message'] = "";
$this->load->view('pages/header.php', $data);
$this->load->view('contact/contact_view', $data);
$this->load->view('pages/footer.php', $data);
}
function send_email() {
if (!isset($data['page_title'])) {
$data['page_title'] = 'Nail Care & Design in Stoke-on-Trent, Staffordshire';
}
if (!isset($data['keywords'])) {
$data['keywords'] = 'Nails, Weddings, Parties, Beauty, Nailcare';
}
if (!isset($data['description'])) {
$data['description'] = 'Nail Care & Design in Stoke-on-Trent, Staffordshire';
}
$data['query'] = $this->get_where(1);
$data['querytwo'] = $this->get('page_headline');
$this->form_validation->set_rules("name", "Name", "required|alpha_numeric_spaces");
$this->form_validation->set_rules("email", "Email", "required|valid_email");
$this->form_validation->set_rules("message", "Message", "required");
if ($this->form_validation->run() == FALSE){
$data["message"] = "";
$this->load->view('pages/header.php', $data);
$this->load->view('contact/contact_view', $data);
$this->load->view('pages/footer.php', $data);
} else {
$data["message"] = "Your email has been successfully sent, thank you.";
$this->load->library("email");
$this->email->from(set_value("email"), set_value("name"));
$this->email->to("myemail@hotmail.co.uk");
$this->email->subject("Website Enquiry for Love Your Nails");
$this->email->message(set_value("message"));
$this->email->send();
echo $this->email->print_debugger();