2014-11-05 3 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

Отсутствующие ';' на линии 17? – Bijan

ответ

0

EDIT: Если ваш mail() работает, используйте эту функцию вместо PHPMailer(), потому что мой предыдущий код должен быть доставлен как.

$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

он не работает, я не получил никаких повторных сообщений. Можете ли вы рассказать мне, как использовать этот код для отправки автоопределения? thnk you :) –

+0

У вас есть ошибки? – Rasclatt

+0

Являются ли эти адреса правильными? '$ autoemail-> AddAddress ($ email, $ name);' где вы хотите, чтобы он ответил? – Rasclatt

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

Смежные вопросы