<?php function
postmail($receiver,$receiver_name,$subject_name,$smassage){require_once("lib/class.phpmailer.php");
//include("lib/class.smtp.php"); $mail=new PHPMailer();$mail->CharSet ="UTF-8";//设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // SMTP authentication
$mail->Host = "smtpcom.263xmail.com"; // SMTP server
$mail->Port = 25; // SMTP port $mail->Username = "[email protected]"; // SMTP 账户名
$mail->Password = "xxx"; // SMTP 账户密码
$mail->SetFrom('[email protected]', 'web');
$mail->Subject = "$subject_name";
$smassage=str_replace('',' ',$smassage);
$smassage=nl2br($smassage);
$mail->MsgHTML("$smassage");
$mail->AddAddress("$receiver","t");//echo "test: " ;
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
} else {
echo "Message sent!";
}
return true;
}
?>
postmail($receiver,$receiver_name,$subject_name,$smassage){require_once("lib/class.phpmailer.php");
//include("lib/class.smtp.php"); $mail=new PHPMailer();$mail->CharSet ="UTF-8";//设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // SMTP authentication
$mail->Host = "smtpcom.263xmail.com"; // SMTP server
$mail->Port = 25; // SMTP port $mail->Username = "[email protected]"; // SMTP 账户名
$mail->Password = "xxx"; // SMTP 账户密码
$mail->SetFrom('[email protected]', 'web');
$mail->Subject = "$subject_name";
$smassage=str_replace('',' ',$smassage);
$smassage=nl2br($smassage);
$mail->MsgHTML("$smassage");
$mail->AddAddress("$receiver","t");//echo "test: " ;
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
} else {
echo "Message sent!";
}
return true;
}
?>
require_once("./lib/class.phpmailer.php");
试试
函数 postmail 在哪里调用的?
{
$smassage=$_POST["smassage"];
$subject_name= $_POST["subject_name"];
$receiver=$_POST["email"];
$receiver_name=$_POST["email"];
postmail($receiver,$receiver_name,$subject_name,$smassage);
exit;} else
?><form id="form1" name="form1" method="post" action="" onsubmit="return form1_onsubmit()">
<table width="100%" border="0" align="center" class="tableBoderForm">
<tr>
<td width="70" height="30">发件人</td>
<td width="1417"><input type="text" name="UserName" value="[email protected]" />
* 必添项</td>
</tr>
<tr>
<td height="30"><p>收件人</p> </td>
<td><input type="text" name="email" value="<?php echo $_GET["email"]; ?>" /></td>
</tr>
<tr>
<td height="30">主题</td>
<td><input name="subject_name" type="text" /></td>
</tr>
<tr>
<td height="20">Massage:</td>
<td><textarea name="smassage" cols="100" rows="20"></textarea></td>
</tr>
<tr>
<td height="30"> </td>
<td><input type="submit" name="Submit" value="发送" />
<input type="reset" name="Reset" value="重置" /></td>
</tr>
</table>
</form>
<div align="center"><br />
<span class="cRed">*</span>
</div>
<br />
</dd>
</dl>
<br />
</body>
</html>
可查看一下/var/log/maillog日志查看一下具体的错误信息.