import('ORG.Net.Email');
$emailer = new Email();
$emailer->setConfig('smtp_host', $this->config['smtp_host']);
$emailer->setConfig('smtp_user', $this->config['smtp_user']);
$emailer->setConfig('smtp_pass', $this->config['smtp_pass']);
$emailer->setConfig('from', $this->config['guestbook']);
$emailer->setConfig('charset', 'UTF-8');
$emailer->sendTo = $this->config['guestbook'];
$emailer->subject = auto_charset("(网站留言){$_POST['title']}", 'utf-8', 'gb2312');
/** 必填字段信息 */
$emailer->content = "<strong>{$_POST['title']}</strong>";
$emailer->content .= "<p>{$_POST['content']}</p>";
$emailer->content .= "{$space}移动电话:{$_POST['mobile']}({$_POST['name']})";
/** 选填字段信息 */
$emailer->content .= "{$space}电子邮件:{$_POST['email']}";
$emailer->content .= "{$space}座机号码:{$_POST['phone']}";
$emailer->content .= "{$space}传真号码:{$_POST['fax']}";
$emailer->content .= "{$space}QQ:{$_POST['qq']}";
$emailer->content .= "{$space}MSN:{$_POST['msn']}";
$result = $emailer->send();
if(true == $result){echo '邮件发送成功!'}else{echo $result;}
目前已经在163.com , 21cn.com, tom.com 及部分企业邮局上测试通过。
不知道对大家有没有用?
-
1.01 KB, 下载次数: 874
