我已经看过很多例子,我最接近的是尝试使用smtp,但我甚至无法使用它,多年来没有这样做只需重新访问一个旧项目它从来没有工作过。
这是我在视图中的表单:
<!--contact form-->
<div id="booking-form">
<div class="form-div">
<form class="form" id="form1" action="site/postData">
<p>
<input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Name" id="name" />
</p>
<p class="email">
<input name="email" type="text" class="validate[required,custom[email]] feedback-input" id="email" placeholder="Email" />
</p>
<p class="text">
<textarea name="text" class="validate[required,length[6,300]] feedback-input" id="comment" placeholder="Message"></textarea>
</p>
<p class="datepick">
<input type="text" id="datepicker" class="validate[required] feedback-input" placeholder="Date">
</p>
<div class="submit">
<input type="submit" value="BOOK" class="button-blue"/>
<!--<div class="ease"></div>-->
</div>
</form>
</div><!--EOF form-div-->
</div> <!--EOF contact form-->
这就是我在控制器中拥有的一切,PostData是我一直在努力的功能:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller {
public function index()
{
$data['myValue'] = "Home";
$this->load->view('index', $data);
}
function postData () {
$this->load->library('email');
$this->email->from($this->input->post('name'), 'Your Name');
$this->email->to('torilclack@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
}
}
我目前得到的错误:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
From: "Your Name" <>
Return-Path: <>
Reply-To: "" <>
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5451ebd5b2b53>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Email_Test?=
Testing the email class.
我已经看到其他帖子中的错误,并且尝试过如上所述的SMTP,但是刚刚从中获取了一个破解的PHP问题,所以没有更好的结果。我知道我在很久以前就有这个工作,然后再打破它。不要以为它太遥远了吗?
帮助将不胜感激。将继续寻找其中