这是我在控制器中的sendmail函数
public function sendmail()
{
$this->load->model("common_model");
$admin = $this->common_model->get_admin('email,name');
$this->load->library('email');
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from($_POST['emailId'], $_POST['firstName']);
$this->email->to($admin[0]->email);
$this->email->subject('User Registered For Model :'.base_url());
$message ="<html> 'r'n";
$message .="<body> 'r'n";
$message .="<table border='0' cellpadding='3' cellspacing='2'>
<tr><td align='left' colspan='2'>Contact Form:-</td></tr>
<tr><th colspan='2'> </th></tr>
<tr><th>Name: </th><td>: ".$_POST['firstName']."</td></tr>
<tr><th>City: </th><td>: ".$_POST['address']."</td></tr>
<tr><th>Email: </th><td>: ".$_POST['emailId']."</td></tr>
<tr><th>Phone: </th><td>: ".$_POST['mobile']."</td></tr>
<tr><th colspan='2'> </th></tr>";
$message .= "</table> 'r'n";
$message .= "</body> 'r'n";
$message.="</html> 'r'n";
$this->email->message($message);
$this->email->send();
redirect('myaccount',$data);
}
我正在使用 WAMP 服务器,这是 WAMP 服务器的设置
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you@yourdomain
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
我做了哪些更改来将邮件发送到其他服务器?或者我的函数中出现了一些错误。所以我不能向其他邮件服务器发送邮件?
您需要指定一个SMTP服务器,将本地主机发送的电子邮件路由到哪里。 如果您尚未在计算机上安装 SMTP 服务器,则localhost
不是一个好值。相反,您应该放置互联网提供商的SMTP服务器。
WAMP 无法发送电子邮件。尝试使用测试邮件服务器工具来测试从本地主机发送的邮件