2014-11-05 118 views
0

這是我的PHP代碼:發送自動回覆電子郵件的形式在PHP

<?php 
$to = '[email protected]'; 
$subject = 'New EMail From Your web site:MakeMoneyCorner.com'; 
$name = $_POST['name']; 
$email = $_POST['email']; 
$message = <<<EMAIL 

from $name 
his email is:$email 
EMAIL; 

$header = '$email'; 

if($_POST){ 
    mail($to, $subject, $message, $header, $feedback) 
    $feedback = 'your information has been successfully Send it'; 

} 

if ($mail->send()){ 
$autoemail = new PHPMailer(); 
$autoemail->From = "[email protected]"; 
$autoemail->FromName = "makingmoneycorner.com"; 
$autoemail->AddAddress($mail->From, $mail->FromName); 
$autoemail->Subject = "This Is Your Book About Making Money"; 
$autoemail->Body = "you can download here :"; 
$autoemail->Send(); 
} 

?> 

** //形式的工作很棒,我能接受,遊客都發送電子郵件,但答覆的內容不工作 爲什麼?

IMG的問題:http://www.gulfup.com/?e4Nb5X

+0

缺少'? – Bijan 2014-11-05 17:37:06

回答

0

編輯:如果您mail()正常工作,使用該功能,而不是PHPMailer()因爲我以前的代碼應該已經交付兩。上線17`;

$to = '[email protected]'; 
$subject = 'New EMail From Your web site:MakeMoneyCorner.com'; 
$name = $_POST['name']; 
$email = $_POST['email']; 
// Your message is set up strangely, try this: 
$message = " 
From: ".ucwords($name)." 
Sent by: $email"; 
// Your header needs the words "From: " in it 
$header = "From: $email"; 

if($_POST){ 
    // You are saying if the mail to you succeeds, continue on. 
    if(mail($to, $subject, $message, $header)) { 
     // Your browser message to them 
     $feedback = 'your information has been successfully Send it'; 
     if(filter_vars($email, FILTER_VALIDATE_EMAIL)) { 
      $headerRep = "From: makingmoneycorner.com <[email protected]>"; 
      $subjectRep = "This Is Your Book About Making Money"; 
      $messageRep = "you can download here :"; 
      mail($email, $subjectRep, $messageRep, $headerRep); 
     } 
    } 
} 
+0

它doesn'y工作,我沒有收到任何重播消息。 你能告訴我一些代碼,用它來發送自動重播 thnk你:) – 2014-11-05 17:01:41

+0

你有錯誤啓用? – Rasclatt 2014-11-05 17:02:19

+0

這些地址是否正確? '$ autoemail-> AddAddress($ email,$ name);'你想在哪裏回覆? – Rasclatt 2014-11-05 17:10:42

0
this th hole code that i use : 

' 
<?php 


$to = '[email protected]'; 
$subject = 'New EMail From Your web site:MakeMoneyCorner.com'; 
$name = $_POST['name']; 
$email = $_POST['email']; 
$message = <<<EMAIL 

from $name 
his email is:$email 
EMAIL; 

$header = '$email'; 

if($_POST){ 
    // You are saying if the mail to you succeeds, continue on. 
    if(mail($to, $subject, $message, $header, $feedback)) { 
     // Your browser message to them 
     $feedback = 'your information has been successfully Send it'; 
     if(filter_vars($email, FILTER_VALIDATE_EMAIL)) { 
      $headerRep = "From: makingmoneycorner.com <[email protected]>"; 
      $subjectRep = "This Is Your Book About Making Money"; 
      $messageRep = "you can download here :"; 
      mail($email, $subjectRep, $messageRep, $headerRep); 
     } 
    } 
} 






?>' 






<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" /> 

<title>make money online</title> 
</head> 
    <div id="wrap">  

    <br> .</br> 

      <form action="?" method="post" > 

       <ul> 
        <li> 
        <label for="name">Your Name:</label> 
        <input type="text" name="name" id="name" /> 
        </li> 

        <li> 
        <label for="email">Your Email:</label> 
        <input type="email" name="email" id="email" /> 
        </li> 

        <li> 
        <input type="submit" value="submit" /> 
        </li> 
       </ul> 

      </form> 




    <p id="feedback"><?php echo $feedback ?></p> 
     <div id="hurry"> 
      <input type="image" src="<?php echo bloginfo('template_directory') . '/images/hurry.png';?>" /> 
     </div><!--end hurry--> 
    </div> <!--END WRAP--> 

    </body> 


</html> 

' 
+0

好吧現在嘗試我的修訂。 – Rasclatt 2014-11-05 23:15:26