我确信这将是一个简单的解决方案但是当我使用我的codeigniter电子邮件表单(我在本地使用xampp)时,它只会在我在表单中输入我自己的电子邮件地址时发送电子邮件 - 显然我希望人们进入自己的。如果我从sendemail.ini auth_username部分删除我的电子邮件,整个过程就会停止工作,所以我确信这与它有关。如果我在表单中输入自己的电子邮件,那么它就可以正常发送。任何想法是什么问题在这里?
我的控制器
<?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("myemail@hotmail.co.uk");
$this->email->subject("Website Enquiry for Love Your Nails");
$this->email->message(set_value("message"));
$this->email->send();
echo $this->email->print_debugger();
答案 0 :(得分:0)
从本地计算机发送电子邮件是一种赌博。您的电子邮件将被发送,但由于您未注册为邮件服务器(粗略地说 - 这里有许多规则参与),您的电子邮件最有可能最终被垃圾邮件发送或者根本不被接受。
发送电子邮件时会有一些称为“得分”的内容。这是保证您不是垃圾邮件发送者的所有因素的组合。每个电子邮件服务都有一个最小的“分数”,低于该分数,它拒绝接受该电子邮件。
在您的情况下,看起来hotmail.co.uk接受分数较低的电子邮件,当其他人输入电子邮件时,他们拒绝来自您计算机的邮件。
换句话说:您需要一个电子邮件服务器来发送受信任的邮件。 要么: