我在Codeigniter很新。但是我正在编写联系表。我希望让访问者填写表格(输入名称,电子邮件和消息),然后他们发送消息时必须进入我的收件箱。
这是我的控制者:
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" =>"\r\n",
);
$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";
}
}
这是我的观点:
<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>
但似乎有错误,我检查了一下,但我不知道我的错误在哪里。你能帮我吗?