在这里,我是
PHP的新手,我想发送邮件,我的应用程序正在运行去爸爸sahre主机所以请告诉我,我可以实现它.
谢谢大家.
谢谢大家.
<!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 = "abhisheks.net@gmail.com"; $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"
The PHP mail() Function
基本示例:
<?PHP $to = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($to,$message,$headers); echo "Mail Sent."; ?>