phpṩһ]l(f)ͺ(sh)mailڳֱӰl(f)]^ԓ(sh)Ҫ(w)֧sendmail
߱O(sh)һ_Ҫ^]l(f)ͷ(w)F(xin)Ҫҵһ_ҪC]l(f)^ܣ
ʹmail(sh)oɹl(f)email
ԼϤSMTPf(xi)hY(ji)socketܾͿԾЧ(wn)]l(f)ͳһÑf̫yڻ(lin)W(wng)ѽ(jng)кܶe˾õ]l(f)ģK҂ֻҪd{(dio)üʮַ㣮
ڴ҂oÑ]һphp¹ʮ֏(qing)M(fi)SMTPģKPHPMailer,(dַhttp://www.phpe.net/class/32.shtml)
PHPMailerһڰl(f)]PHP(sh)ṩĹܰ
*.ڰl(f)]rָռ͵ַ͵ַͻ؏(f)ַ
*.ֶ֧N]a8bitbase64binaryquoted-printable
*.֧SMTPC
*.֧SMTP(w)
*.֧֎]Htmlʽ]
*.Զx]^
*.֧]ǶDƬ
*.{(dio)ԇ`
*.(jng)yԇݵSMTP(w)Sendmail,qmail,Postfix,Imail,Exchange
*.\(yn)κƽ_֮
dԓMʾaɌF(xin)phpھl(f)]
һǰ_
<html>
<body>
<h3>phpmailer Unit Test</h3>
Ոݔ<font color="#FF6666"></font>]ַ:
<form name="phpmailer" action="send.php" method="post">
<input type="hidden" name="submitted" value="1"/>
]ַ: <input type="text" size="50" name="address" />
<br/>
<input type="submit" value="l(f)"/>
</form>
</body>
</html>
_PHP
<?php
require("class.phpmailer.php"); //dļ횷ԓļĿ
$mail = new PHPMailer(); //]l(f)
$address = $_POST['address'];
$mail->IsSMTP(); // ʹSMTPʽl(f)
$mail->Host = "mail.xxxxx.com"; // I(y)]
$mail->SMTPAuth = true; // SMTPC
$mail->Username = "[email protected]"; // ]Ñ(Ո?zh)emailַ)
$mail->Password = "******"; // ]ܴa
$mail->From = "[email protected]"; //]l(f)emailַ
$mail->FromName = "Q";
$mail->AddAddress("$address", "");//ռ˵ַQκҪ]email,ʽAddAddress("ռemail","ռ")
//$mail->AddReplyTo("", "");
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // Ӹ
//$mail->IsHTML(true); // set email format to HTML //ǷʹHTMLʽ
$mail->Subject = "PHPMaileryԇ]"; //](bio)}
$mail->Body = "Hello,@ǜyԇ]"; //](ni)
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //Ϣʡ
if(!$mail->Send())
{
echo "]l(f)ʧ. <p>";
echo "e`ԭ: " . $mail->ErrorInfo;
exit;
}
echo "]l(f)ͳɹ";
?>