Im trying to create a "contact us" form where visitors will be able to email the site owner.
so far, my form works if the visitor who filled up the form uses a gmail address. but once they use a yahoo email address the recipient(site owner) does not receive the mail
below is how i did the form
controller
public function send_email(){
$data = $_POST;
$new = $this->base_model->send_email($data);
$this->session->set_flashdata("email_status","Message successfully sent");
redirect(base_url("contact"));
}
model
public function send_email($email_data)
{
$from = $email_data['email'];
$subject = $email_data['subject'];
$message = $this->load->view("emails/message",$email_data,TRUE);
$config['crlf'] = "\n";
$config['mailtype'] = "html";
$config['protocol'] = "sendmail";
$this->load->library('email');
$this->email->initialize($config);
$this->email->from($from,$email_data['name']);
$this->email->to("site owner email address goes here");
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
return $this->email->print_debugger();
}
view
<?php
$attributes = array("id"=>"form_req");
echo form_open("send_email",$attributes);
?>
<div class="controls">
<label>Name</label>
<input type="text" name="name" class="span12 req">
</div>
<div class="controls">
<label>Email</label>
<input type="text" name="email" class="span12 req">
</div>
<div class="controls">
<label>Subject</label>
<input type="text" name="subject" class="span12 req">
</div>
<div class="controls">
<label>Message</label>
<textarea name="message" class="span12 req"></textarea>
</div>
<button class="btn"><i class="fa fa-send"></i> Send</button>
<?php
echo form_close();
?>
have i missed something? or is there a workaround for this?