我敢肯定,這將是一個簡單的解決方案,但是當我使用我的codeigniter電子郵件表單(我在本地使用xampp)它只會在我輸入自己的電子郵件地址時發送電子郵件在形式上 - 這顯然我希望人們輸入自己的。如果我從sendemail.ini auth_username部分中刪除了我的電子郵件,那麼整個事情就會停止,所以我相信這與此有關。如果我在表格中輸入我自己的電子郵件,它會得到很好的交付。任何想法是什麼問題在這裏?Codeigniter電子郵件只適用於我的電子郵件
我的控制器
<?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("[email protected]");
$this->email->subject("Website Enquiry for Love Your Nails");
$this->email->message(set_value("message"));
$this->email->send();
echo $this->email->print_debugger();
你不會是能夠從本地主機發送郵件沒有特殊的設置或使用像Mailgun。 – Adam