За последние 24 часа нас посетили 21455 программистов и 1025 роботов. Сейчас ищут 707 программистов ...

Не отправляется почтовое сообщение

Тема в разделе "Сделайте за меня", создана пользователем arven, 20 окт 2013.

  1. arven

    arven Новичок

    С нами с:
    20 окт 2013
    Сообщения:
    1
    Симпатии:
    0
    Здравствуйте, уважаемые форумчане!
    Очень нужна помощь в настройке почтового скрипта. Есть сайт на WordPress, тема Webfolio, на странице контактов форма отправки сообщения: http://cool-site4you.ru/kontaktyi/
    При отправке сообщений, если поля не заполнены, выводятся ошибки, а если все поля заполнены, не происходит ничего - ни сообщения об успешной отправке, ни письма на почту. Попробуйте сами!

    Код, отвечающий за вывод страницы:
    Код (Text):
    1.  
    2. <?php
    3. /*
    4. Template Name: Contact
    5. */
    6. if(isset($_POST['submitted'])) {
    7.         //Check to make sure that the name field is not empty
    8.         if(trim($_POST['contactName']) === '') {
    9.             $nameError = __("You forgot to enter your name.", "site5framework");
    10.             $hasError = true;
    11.         } else {
    12.             $name = trim($_POST['contactName']);
    13.         }
    14.  
    15.         //Check to make sure sure that a valid email address is submitted
    16.         if(trim($_POST['email']) === '')  {
    17.             $emailError = __("You forgot to enter your email address.", "site5framework");
    18.             $hasError = true;
    19.         } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
    20.             $emailError = __("You entered an invalid email address.", "site5framework");
    21.             $hasError = true;
    22.         } else {
    23.             $email = trim($_POST['email']);
    24.         }
    25.  
    26.         //Check to make sure comments were entered
    27.         if(trim($_POST['comments']) === '') {
    28.             $commentError = __("You forgot to enter your comments.", "site5framework");
    29.             $hasError = true;
    30.         } else {
    31.             if(function_exists('stripslashes')) {
    32.                 $comments = stripslashes(trim($_POST['comments']));
    33.             } else {
    34.                 $comments = trim($_POST['comments']);
    35.             }
    36.         }
    37.  
    38.         //If there is no error, send the email
    39.         if(!isset($hasError)) {
    40.             $msg .= "------------User informations------------ \r\n"; //Title
    41.             $msg .= "User IP: ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
    42.             $msg .= "Browser Info: ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
    43.             $msg .= "Referrer: ".$_SERVER["HTTP_REFERER"]; //Referrer
    44.  
    45.             $emailTo = ".get_option('webfolio_contact_email').";
    46.             $subject = 'Contact Form Submission from '.$name;
    47.             $body = "Name: $name \n\nEmail: $email \n\nMessage: $comments \n\n $msg";
    48.             $headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;
    49.  
    50.             if(mail($emailTo, $subject, $body, $headers)) $emailSent = true;
    51.     }
    52. }
    53. get_header(); ?>
    54.  
    55. <!-- begin colLeft -->
    56.  
    57.             <section class="clearfix" class="colFull">
    58.             <h1><?php _e("Contact Us", "site5framework"); ?></h1>
    59.             <p><?php echo stripslashes(stripslashes(of_get_option('webfolio_contact_text')))?></p>
    60.             <?php
    61.                 if(of_get_option('webfolio_contact_map')!="") {
    62.             ?>
    63.                 <div id="contact-map">
    64.                     <?php echo of_get_option('webfolio_contact_map'); ?>
    65.                 </div>
    66.             <?php
    67.                 }
    68.             ?>
    69.              <div id="contact-form">
    70.             <?php if(isset($hasError)) { ?>
    71.                         <p class="error"><?php _e("There was an error submitting the form.", "site5framework"); ?><p>
    72.                     <?php } ?>
    73.                     <form id="contactForm" action="<?php the_permalink(); ?>" method="POST">
    74.                     <div>
    75.                     <label for="nameinput"><?php _e("Your name", "site5framework"); ?></label>
    76.                         <input type="text" id="nameinput" name="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField"/>
    77.                     <?php if($nameError != '') { ?>
    78.                           <span class="error"><?=$nameError;?></span>
    79.                           <?php } ?>
    80.                     </div>
    81.                     <div>
    82.                     <label for="emailinput"><?php _e("Your email", "site5framework"); ?></label>
    83.                         <input type="text" id="emailinput" name="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email"/>
    84.                         <?php if($emailError != '') { ?>
    85.                           <span class="error"><?=$emailError;?></span>
    86.                           <?php } ?>
    87.                     </div>
    88.                     <div>
    89.                     <label for="commentinput"><?php _e("Your message", "site5framework"); ?></label>
    90.                         <textarea cols="20" rows="7" id="commentinput" name="comments" class="requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
    91.                         <?php if($commentError != '') { ?>
    92.                           <span class="error"><?=$commentError;?></span><?php } ?>
    93.                     </div><br />
    94.                     <input type="hidden" name="submitted" id="submitted" value="true" />
    95.                     <button type="submit" id="submitbutton" class="submitbutton"><?php _e("SEND", "site5framework"); ?></button>
    96.                     </form>
    97.             </div>
    98.  
    99.             <div id="contact-data">
    100.                     <?php
    101.                         if(of_get_option('webfolio_contact_address')!="") {
    102.                     ?>  <p>
    103.                         <span class="contact-data-field"><?php _e("Address", "site5framework"); ?>:</span>
    104.                         <span class="contact-data-info"><?php echo of_get_option('webfolio_contact_address'); ?></span>
    105.                         </p>
    106.                     <?php } ?>
    107.                     <?php
    108.                         if(of_get_option('webfolio_contact_phone')!="") {
    109.                     ?>  <p>
    110.                         <span class="contact-data-field"><?php _e("Phone", "site5framework"); ?>:</span>
    111.                         <span class="contact-data-info"><?php echo of_get_option('webfolio_contact_phone'); ?></span>
    112.                         </p>
    113.                     <?php } ?>
    114.                     <?php
    115.                         if(of_get_option('webfolio_contact_fax')!="") {
    116.                     ?>  <p>
    117.                         <span class="contact-data-field"><?php _e("Fax", "site5framework"); ?>:</span>
    118.                         <span class="contact-data-info"><?php echo of_get_option('webfolio_contact_fax'); ?></span>
    119.                         </p>
    120.                     <?php } ?>
    121.             </div>
    122.             </section>  <!-- end section -->
    123.  
    124. <?php get_footer(); ?>
    Меня смущает строчка
    Код (Text):
    1. <form id="contactForm" action="<?php the_permalink(); ?>" method="POST">
    и тот факт, что вместо лейблов Your name, Your email у полей формы выводятся You forgot to enter your name, You forgot to enter your email - это видно, если убрать перевод, т.е. переключиться на английскую версию.
    Помогите, пожалуйста!