我正在尝试在共享服务器上发送邮件。我的错误页面是
<br />
<b>Warning</b>: mail() [<a href='function.mail'>function.mail</a>]: SMTP server response: 452 4.3.1 Out of memory in <b>D:\hshome\......\form.php</b> on line <b>21</b><br />
email didnt send
<META HTTP-EQUIV ="Refresh" CONTENT =" 1; URL= Thank.html" />
这是form.php
<?php
include ("config.php");
$mail_check=true;
if(trim($_POST["name"])=="")
$mail_check=false;
if(trim($_POST["email"])=="")
$mail_check=false;
if(trim($_POST["subject"])=="")
$mail_check=false;
if($mail_check){
$to=$config["email"];
$subject = $_POST["subject"];
$message = '<html><head><title>$lang["newemailarriveed"]</title></head><body>
test
</body></html>';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: '.$_POST["name"].' <'.$_POST["email"].'>' . "\r\n";
if(mail($to, $subject, $message, $headers)){
echo $lang["success"];
}
else{
echo $lang["eror1"];
}
}else{
echo $lang["eror2"];
}
?>
虽然config.php
是
<?php
// ServCombina
// Contact Form By TalGarty
$config = Array(
"email" => "info@example.com",
);
$lang = Array(
"newemailarriveed" => "new mail",
"newemailfrom" => "from",
"info" => "detail",
"fullname" => "name",
"iemail" => "email",
"phone" => "phone",
"success" => "success",
"eror1" => "email didnt send",
"eror2" => "one or more of the fields are empty",
);
?>
*这是在 Windows 共享服务器上
我不得不说我不太了解 php,我尝试通过它发送电子邮件asp.net
并且它有效,但是我不能搬到asp.net
我必须留在php
。
在asp.net
以下代码中有效:
String s_name = "", s_email = "", s_phone = "";
if (name != null && name.Text != null) { s_name = name.Text; }
if (email != null && email.Text != null) { s_email = email.Text; }
if (phone != null && phone.Text != null) { s_phone = phone.Text; }
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("example@example.com");
mailMessage.From = new MailAddress("info@example.com");
mailMessage.Subject = "test";
mailMessage.Body = @"<!DOCTYPE html> "+
"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>new email</title></head><body> " +
"test" +
"</body></html>";
SmtpClient smtpClient = new SmtpClient("mail.example.com");
smtpClient.Send(mailMessage);
Response.Redirect("~/aaa/Thank.html");