21,886
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<p>在php外部</p>
<?php
echo "在if外部!";
require("class.phpmailer.php");
if($_POST['Submit'])
{
echo "进入if内部!";
$mail = new PHPMailer();
echo "$mail = new PHPMailer();";
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.sina.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@sina.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = "username@sina.com";
$mail->FromName = "Mailer";
$mail->AddAddress("username@sina.com"); // name is optional
$mail->AddReplyTo("username@sina.com", "Information");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "测试邮件";
$mail->Body = "测试的邮件";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
?>
</body>
</html>