Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

sendmail - Sending mail in php

Here i am new to PHP, i want to send the mail and my application is running on go daddy sahre hosting so please tell me hows can i achieve it . thanks to all.

I got the response from you guys and I tried but there is some problem .
this is my code ..

  <!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>

And after running this page i got the error

"Warning: mail() [function.mail]: SMTP server response: 554 The message was rejected because it contains prohibited virus or spam content in D:Hosting5676400htmlmyPhpempadminsendMail.php on line 17"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The PHP mail() Function

Basic Example:

<?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,$subject,$message,$headers);
echo "Mail Sent.";
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...