最近在做一个发邮件的东西,遇到了麻烦,各位看一下,帮忙。先做一个简单的例子:<?php
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'utf-8';
$mail->Encoding = 'base64';
$mail->From = '[email protected]';
$mail->FromName ='SRV Chinese School';
$mail->Host ='ssl://smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "***************";
$mail->AddAddress("[email protected]");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "[测试]this is a test email from phpmailer";
$mail->Body = "Do you receive it?你收到了吗?";
if(!$mail->Send())
{
echo "通知信件寄出失敗";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "通知信件已寄出";
?>收取情况如下:
主 题: [测试]this is a test email from phpmailer
时 间: 2010年1月1日(星期五) 11:32
发件人: "SRV Chinese School" <[email protected]>
收件人: [email protected]
抄送人: (无)
问题是:发件人显示的是[email protected] ,但是我想让$mail->From = '[email protected]';中的这个'[email protected]'显示在发件人的位置,不知能否实现?小弟急求,不然工作就丢了.
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'utf-8';
$mail->Encoding = 'base64';
$mail->From = '[email protected]';
$mail->FromName ='SRV Chinese School';
$mail->Host ='ssl://smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "***************";
$mail->AddAddress("[email protected]");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "[测试]this is a test email from phpmailer";
$mail->Body = "Do you receive it?你收到了吗?";
if(!$mail->Send())
{
echo "通知信件寄出失敗";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "通知信件已寄出";
?>收取情况如下:
主 题: [测试]this is a test email from phpmailer
时 间: 2010年1月1日(星期五) 11:32
发件人: "SRV Chinese School" <[email protected]>
收件人: [email protected]
抄送人: (无)
问题是:发件人显示的是[email protected] ,但是我想让$mail->From = '[email protected]';中的这个'[email protected]'显示在发件人的位置,不知能否实现?小弟急求,不然工作就丢了.
解决方案 »
- option语句里权限问题
- php字符串截取问题!!急!!
- Warning: Call-time pass-by-reference has been deprecated; If you would like to p
- 紧急求助:wampserver中80端口被占用,改为82也不行,怎么办??
- 大家 知道 div可以嵌套 那么 我这样嵌可不可以呢 ?
- java向php post数据时, 中文显示问号问题
- IE5.0中怎么不能得到$_SERVER["HTTP_REFERER"]呢?
- 看看吧,想改變這种現象!!<marquee>能移動內容,但它移動時有空白(要等全移完后才又重新移)能否不要這中間的空隙。
- 这个问题谁能帮我解决一下,先谢了!
- php如何get获取id,然后通过id查询后将数据返给html,html的datagrid接收值。
- 新做了个网站建设网站,大家给提提建议!谢谢!!(散分)
- 新年散分
public function Authenticate($username, $password) {
// Start authentication
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); $rply = $this->get_lines();
$code = substr($rply,0,3); if($code != 334) {
$this->error =
array("error" => "AUTH not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF;
}
return false;
} // Send encoded username
fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); $rply = $this->get_lines();
$code = substr($rply,0,3); if($code != 334) {
$this->error =
array("error" => "Username not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF;
}
return false;
} // Send encoded password
fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); $rply = $this->get_lines();
$code = substr($rply,0,3); if($code != 235) {
$this->error =
array("error" => "Password not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF;
}
return false;
} return true;
}