I am so new at codeigniter. But I am working on a contact form. I want that let visitor fulfill the form (input name,email and message) then when they send the message must come into my inbox.
This is my controller:
public function ilet(){
$name = $this->input->post("name");
$email = $this->input->post("email");
$message = $this->input->post("message");
$config = array(
"protocol" => "smtp",
"smtp_host" => "ssl://smtp.gmail.com",
"smtp_port" =>"465",
"smtp_user" =>$email,
"starttls" =>true,
"charset" =>"utf-8",
"mailtype" =>"html",
"wordwrap" => true,
"newline" =>"
",
);
$this->load->library("email", $config);
$this->mail->from($email);
$this->email->to("cugurel7@gmail.com");
$this->email->subject("Müşteri bilgi mesajı");
$this->email->message($message);
$send = $this->email->send();
if($send)
{
echo "Mail gönderme işlemi başarılı";
}
else {
echo "Başarısız";
}
}
this is my view:
<form id="contact-form" action="/yansayfa/ilet" method="POST" >
<div class="row">
<div class="col-md-6">
<div class="form-group" ">
<label for="form_name">Adınız Soyadınız</label>
<input style="border-radius: 0px;" id="name" type="text" name="name" class="form-control"
placeholder="İsim & Soyisim"
>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="form_lastname">E-posta</label>
<input style="border-radius: 0px;" id="email" type="email" name="email" class="form-control"
placeholder="E-posta">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="form_message">Mesajınız *</label>
<textarea style="border-radius: 0px;" id="message" name="message" class="form-control"
placeholder="Mesaj Giriniz..." rows="4" ></textarea>
</div>
</div>
<div class="col-md-12">
<input type="submit" id="mybtn" style="border-radius: 0px;" class="btn btn-success btn-send" value="Gönder">
</div>
</div>
</div>
</form>
but it seems error and i checked but i dont know where is my error. Can u please help me?