這裏我是PHP的新手,我想發送郵件,我的應用程序正在運行,爸爸sahre託管所以請告訴我,我可以實現它。 謝謝大家。在php發送郵件
我收到了你們的回覆,我試過了,但有一些問題。
這是我的代碼..
<!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=utf-8" />
<title>Send Mail</title>
</head>
<body>
<?php
if(isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['msg']))
{
$to = $_POST['email'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$msg,$headers);
echo "Mail Send";
}
?>
<form action="sendMail.php" method="post">
<div>
<table style="width:100%;">
<tr>
<td>Email:</td>
<td><input type="text" name="email" /></td>
<td>Subject:</td>
<td><input type="text" name="subject" /></td>
</tr>
<tr>
<td>Message</td>
<td><input type="text" name="msg" /></td>
<td colspan="2"> <input type="submit" value="Send Mail" /></td>
</tr>
</table>
</div>
</form>
</body>
</html>
而且運行後此頁我得到了錯誤
"Warning: mail() [function.mail]: SMTP server response: 554 The message was rejected because it contains prohibited virus or spam content in D:\Hosting\5676400\html\myPhp\temp\admin\sendMail.php on line 17"
www.php.net /manual/en/function.mail.php – 2010-09-15 03:59:39