matrix_ret
Новичок
- Регистрация
- 19.11.2012
- Сообщения
- 1
Привет.
Письма отправленные с сайта на yahoo не доходят, а уведомления о новых комментариях на сайте доходят.
Вот код страницы обратной связи:
Не знаю что и где нужно исправить.
Сайт на движке WordPress.
Письма отправленные с сайта на yahoo не доходят, а уведомления о новых комментариях на сайте доходят.
Вот код страницы обратной связи:
Код:
<?php
/**
* Contact form based on the original code by Orman Clark
* http://www.premiumpixels.com
*/
defined('GANTRY_VERSION') or die();
gantry_import('core.gantrybodylayout');
global $post, $posts, $query_string;
/**
*
* @package gantry
* @subpackage html.layouts
*/
class GantryLayoutBody_ContactForm extends GantryBodyLayout {
var $render_params = array(
'schema' => null,
'pushPull' => null,
'classKey' => null,
'sidebars' => '',
'contentTop' => null,
'contentBottom' => null
);
function render($params = array()) {
global $gantry;
$fparams = $this-> _getParams($params);
// logic to determine if the component should be displayed
$display_mainbody = !($gantry->get("mainbody-enabled", true) == false);
$display_component = !($gantry->get("maincontentstyle-component-enabled", true) == false);
$name_error = '';
$email_error = '';
$message_error = '';
if(isset($_POST['submitted'])) {
if(trim($_POST['rt-contact-name']) === '') {
$name_error = _e('Please enter your name.','dp_theme');
$hasError = true;
} else {
$name = trim($_POST['rt-contact-name']);
}
if(trim($_POST['rt-contact-email']) === '') {
$email_error = _e('Please enter your email address.','dp_theme');
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['rt-contact-email']))) {
$email_error = _e('You entered an invalid email address.','dp_theme');
$hasError = true;
} else {
$email = trim($_POST['rt-contact-email']);
}
if(trim($_POST['rt-contact-message']) === '') {
$message_error = _e('Please enter a message.','dp_theme');
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['rt-contact-message']));
} else {
$comments = trim($_POST['rt-contact-message']);
}
}
if(!isset($hasError)) {
$emailTo = $gantry->get('contact-email');
if (!isset($emailTo) || ($emailTo == '') ){
$emailTo = get_option('admin_email');
}
$subject = '[Contact Form] From '.$name;
$body = "Name: $name \n\nEmail: $email \n\nMessage: $comments";
$headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
if(isset($_POST['rt-send-copy']) && $_POST['rt-send-copy'] == true) {
mail($email, $subject, $body, $headers);
}
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
}
ob_start();
// XHTML LAYOUT
?>
<?php if ($display_mainbody) : ?>
<div id="rt-main-overlay">
<div id="rt-main" class="<?php echo $fparams->classKey; ?>">
<div class="rt-main-inner">
<div class="rt-grid-<?php echo $fparams->schema['mb']; ?> <?php echo $fparams->pushPull[0]; ?>">
<?php if (isset($fparams->contentTop)) : ?>
<div id="rt-content-top">
<?php echo $fparams->contentTop; ?>
<div class="clear"></div>
</div>
<?php endif; ?>
<div class="rt-block">
<?php if ($display_component) : ?>
<div class="<?php echo $gantry->get('articlestyle'); ?> details-<?php echo $gantry->get('articledetails'); ?>">
<div id="rt-mainbody">
<!-- Begin Contact Form Template -->
<div class="rt-wordpress">
<div class="rt-contactform">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- Begin Post -->
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<?php if($gantry->get('page-title')) : ?>
<!-- Begin Title -->
<div class="module-title-surround">
<div class="module-title">
<h2 class="title">
<?php the_title(); ?>
</h2>
</div>
<div class="rt-articleinfo-data">
<?php if($date) : ?>
<?php the_time('d F'); ?>
<?php endif; ?>
</div>
</div>
<div class="clear"></div>
<!-- End Title -->
<?php endif; ?>
<?php if($gantry->get('page-meta-comments') || $gantry->get('page-meta-date') || $gantry->get('page-meta-modified') || $gantry->get('page-meta-author')) : ?>
<!-- Begin Meta -->
<div class="rt-articleinfo">
<div class="rt-articleinfo-text">
<?php if($gantry->get('page-meta-date')) : ?>
<!-- Begin Date & Time -->
<span class="rt-date-posted"><!--<?php _re('Posted on'); ?> --> <?php the_time('l, d F Y H:i'); ?></span>
<!-- End Date & Time -->
<?php endif; ?>
<?php if($gantry->get('page-meta-modified')) : ?>
<!-- Begin Modified Date -->
<span class="rt-date-modified"><?php _re('Last Updated on'); ?> <?php the_modified_date('l, d F Y H:i'); ?></span>
<!-- End Modified Date -->
<?php endif; ?>
<?php if($gantry->get('page-meta-author')) : ?>
<!-- Begin Author -->
<span class="rt-author"><?php _re('Written by'); ?> <?php the_author(); ?></span>
<!-- End Author -->
<?php endif; ?>
<?php if($gantry->get('page-meta-comments')) : ?>
<!-- Begin Comments -->
<span class="rt-comment-text"><?php comments_number(_r('0 Comments'), _r('1 Comment'), _r('% Comments')); ?></span>
<!-- End Comments -->
<?php endif; ?>
</div>
</div>
<!-- End Meta -->
<?php endif; ?>
<div class="module-content">
<!-- Begin Email Confirmation -->
<?php if(isset($emailSent) && $emailSent == true) { ?>
<div class="approved">
<div class="typo-icon">
<?php _re('Thanks, your email was sent successfully.'); ?>
</div>
</div>
<?php } else { ?>
<!-- Begin Email Confirmation -->
<!-- Begin Post Content -->
<?php the_content(); ?>
<div class="clear"></div>
<?php if(isset($hasError)) { ?>
<div class="alert">
<div class="typo-icon">
<?php _re('Sorry, an error occurred.') ?>
</div>
</div>
<?php } ?>
<!-- Begin Contact Form -->
<form action="<?php the_permalink(); ?>" id="rt-contact-form" method="post">
<?php if($name_error != '') { ?>
<div class="alert">
<div class="typo-icon">
<?php echo $name_error; ?>
</div>
</div>
<?php } ?>
<p>
<label for="rt-contact-name" class="contact-label"><?php _re('Name'); ?> <span class="required">*</span></label>
<input name="rt-contact-name" id="rt-contact-name" value="<?php if(isset($_POST['rt-contact-name'])) echo $_POST['rt-contact-name'];?>" class="inputbox" />
</p>
<?php if($email_error != '') { ?>
<div class="alert">
<div class="typo-icon">
<?php echo $email_error; ?>
</div>
</div>
<?php } ?>
<p>
<label for="rt-contact-email" class="contact-label"><?php _re('Email'); ?> <span class="required">*</span></label>
<input name="rt-contact-email" id="rt-contact-email" value="<?php if(isset($_POST['rt-contact-email'])) echo $_POST['rt-contact-email'];?>" class="inputbox" />
</p>
<?php if($message_error != '') { ?>
<div class="alert">
<div class="typo-icon">
<?php echo $message_error; ?>
</div>
</div>
<?php } ?>
<p>
<label for="rt-contact-message" class="contact-label"><?php _re('Message'); ?> <span class="required">*</span></label>
<textarea name="rt-contact-message" id="rt-contact-message" rows="10" cols="83" class="inputbox"></textarea>
</p>
<div id="contact-form-buttons">
<input type="checkbox" name="rt-send-copy" id="rt-send-copy" value="true" />
<label for="rt-send-copy" class="rt-send-copy"><?php _re('Send me a copy of this email.'); ?></label>
<div id="contact-form-send" class="readon">
<button class="button" type="submit" name="submit" tabindex="5" id="submit"><?php _re('Send Email'); ?></button>
</div>
<input type="hidden" name="submitted" id="submitted" value="true" />
<div style="clear:both;"></div>
</div>
</form>
<!-- End Contact Form -->
<?php } ?>
<?php wp_link_pages('before=<div class="rt-pagination">'._r('Pages:').'&after=</div><br />'); ?>
<?php edit_post_link(_r('Edit this entry.'), '<div class="edit-entry">', '</div>'); ?>
<!-- End Post Content -->
</div>
</div>
<!-- End Post -->
<?php endwhile;?>
<?php else : ?>
<h2 class="title">
<?php _re('Sorry, no pages matched your criteria.'); ?>
</h2>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>
<!-- End Contact Form Template -->
</div>
<div class="clear"></div>
</div>
<?php endif; ?>
</div>
<?php if (isset($fparams->contentBottom)) : ?>
<div id="rt-content-bottom">
<?php echo $fparams->contentBottom; ?>
</div>
<?php endif; ?>
</div>
<?php echo $fparams->sidebars; ?>
<div class="clear"></div>
</div>
</div>
</div>
<?php endif; ?>
<?php
return ob_get_clean();
}
}
Сайт на движке WordPress.
Может надо что-то в phpmailer поменять?Привет.
Письма отправленные с сайта на yahoo не доходят, а уведомления о новых комментариях на сайте доходят.
Вот код страницы обратной связи:
Не знаю что и где нужно исправить.Код:<?php /** * Contact form based on the original code by Orman Clark * http://www.premiumpixels.com */ defined('GANTRY_VERSION') or die(); gantry_import('core.gantrybodylayout'); global $post, $posts, $query_string; /** * * @package gantry * @subpackage html.layouts */ class GantryLayoutBody_ContactForm extends GantryBodyLayout { var $render_params = array( 'schema' => null, 'pushPull' => null, 'classKey' => null, 'sidebars' => '', 'contentTop' => null, 'contentBottom' => null ); function render($params = array()) { global $gantry; $fparams = $this-> _getParams($params); // logic to determine if the component should be displayed $display_mainbody = !($gantry->get("mainbody-enabled", true) == false); $display_component = !($gantry->get("maincontentstyle-component-enabled", true) == false); $name_error = ''; $email_error = ''; $message_error = ''; if(isset($_POST['submitted'])) { if(trim($_POST['rt-contact-name']) === '') { $name_error = _e('Please enter your name.','dp_theme'); $hasError = true; } else { $name = trim($_POST['rt-contact-name']); } if(trim($_POST['rt-contact-email']) === '') { $email_error = _e('Please enter your email address.','dp_theme'); $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['rt-contact-email']))) { $email_error = _e('You entered an invalid email address.','dp_theme'); $hasError = true; } else { $email = trim($_POST['rt-contact-email']); } if(trim($_POST['rt-contact-message']) === '') { $message_error = _e('Please enter a message.','dp_theme'); $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['rt-contact-message'])); } else { $comments = trim($_POST['rt-contact-message']); } } if(!isset($hasError)) { $emailTo = $gantry->get('contact-email'); if (!isset($emailTo) || ($emailTo == '') ){ $emailTo = get_option('admin_email'); } $subject = '[Contact Form] From '.$name; $body = "Name: $name \n\nEmail: $email \n\nMessage: $comments"; $headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; if(isset($_POST['rt-send-copy']) && $_POST['rt-send-copy'] == true) { mail($email, $subject, $body, $headers); } mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ob_start(); // XHTML LAYOUT ?> <?php if ($display_mainbody) : ?> <div id="rt-main-overlay"> <div id="rt-main" class="<?php echo $fparams->classKey; ?>"> <div class="rt-main-inner"> <div class="rt-grid-<?php echo $fparams->schema['mb']; ?> <?php echo $fparams->pushPull[0]; ?>"> <?php if (isset($fparams->contentTop)) : ?> <div id="rt-content-top"> <?php echo $fparams->contentTop; ?> <div class="clear"></div> </div> <?php endif; ?> <div class="rt-block"> <?php if ($display_component) : ?> <div class="<?php echo $gantry->get('articlestyle'); ?> details-<?php echo $gantry->get('articledetails'); ?>"> <div id="rt-mainbody"> <!-- Begin Contact Form Template --> <div class="rt-wordpress"> <div class="rt-contactform"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- Begin Post --> <div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> <?php if($gantry->get('page-title')) : ?> <!-- Begin Title --> <div class="module-title-surround"> <div class="module-title"> <h2 class="title"> <?php the_title(); ?> </h2> </div> <div class="rt-articleinfo-data"> <?php if($date) : ?> <?php the_time('d F'); ?> <?php endif; ?> </div> </div> <div class="clear"></div> <!-- End Title --> <?php endif; ?> <?php if($gantry->get('page-meta-comments') || $gantry->get('page-meta-date') || $gantry->get('page-meta-modified') || $gantry->get('page-meta-author')) : ?> <!-- Begin Meta --> <div class="rt-articleinfo"> <div class="rt-articleinfo-text"> <?php if($gantry->get('page-meta-date')) : ?> <!-- Begin Date & Time --> <span class="rt-date-posted"><!--<?php _re('Posted on'); ?> --> <?php the_time('l, d F Y H:i'); ?></span> <!-- End Date & Time --> <?php endif; ?> <?php if($gantry->get('page-meta-modified')) : ?> <!-- Begin Modified Date --> <span class="rt-date-modified"><?php _re('Last Updated on'); ?> <?php the_modified_date('l, d F Y H:i'); ?></span> <!-- End Modified Date --> <?php endif; ?> <?php if($gantry->get('page-meta-author')) : ?> <!-- Begin Author --> <span class="rt-author"><?php _re('Written by'); ?> <?php the_author(); ?></span> <!-- End Author --> <?php endif; ?> <?php if($gantry->get('page-meta-comments')) : ?> <!-- Begin Comments --> <span class="rt-comment-text"><?php comments_number(_r('0 Comments'), _r('1 Comment'), _r('% Comments')); ?></span> <!-- End Comments --> <?php endif; ?> </div> </div> <!-- End Meta --> <?php endif; ?> <div class="module-content"> <!-- Begin Email Confirmation --> <?php if(isset($emailSent) && $emailSent == true) { ?> <div class="approved"> <div class="typo-icon"> <?php _re('Thanks, your email was sent successfully.'); ?> </div> </div> <?php } else { ?> <!-- Begin Email Confirmation --> <!-- Begin Post Content --> <?php the_content(); ?> <div class="clear"></div> <?php if(isset($hasError)) { ?> <div class="alert"> <div class="typo-icon"> <?php _re('Sorry, an error occurred.') ?> </div> </div> <?php } ?> <!-- Begin Contact Form --> <form action="<?php the_permalink(); ?>" id="rt-contact-form" method="post"> <?php if($name_error != '') { ?> <div class="alert"> <div class="typo-icon"> <?php echo $name_error; ?> </div> </div> <?php } ?> <p> <label for="rt-contact-name" class="contact-label"><?php _re('Name'); ?> <span class="required">*</span></label> <input name="rt-contact-name" id="rt-contact-name" value="<?php if(isset($_POST['rt-contact-name'])) echo $_POST['rt-contact-name'];?>" class="inputbox" /> </p> <?php if($email_error != '') { ?> <div class="alert"> <div class="typo-icon"> <?php echo $email_error; ?> </div> </div> <?php } ?> <p> <label for="rt-contact-email" class="contact-label"><?php _re('Email'); ?> <span class="required">*</span></label> <input name="rt-contact-email" id="rt-contact-email" value="<?php if(isset($_POST['rt-contact-email'])) echo $_POST['rt-contact-email'];?>" class="inputbox" /> </p> <?php if($message_error != '') { ?> <div class="alert"> <div class="typo-icon"> <?php echo $message_error; ?> </div> </div> <?php } ?> <p> <label for="rt-contact-message" class="contact-label"><?php _re('Message'); ?> <span class="required">*</span></label> <textarea name="rt-contact-message" id="rt-contact-message" rows="10" cols="83" class="inputbox"></textarea> </p> <div id="contact-form-buttons"> <input type="checkbox" name="rt-send-copy" id="rt-send-copy" value="true" /> <label for="rt-send-copy" class="rt-send-copy"><?php _re('Send me a copy of this email.'); ?></label> <div id="contact-form-send" class="readon"> <button class="button" type="submit" name="submit" tabindex="5" id="submit"><?php _re('Send Email'); ?></button> </div> <input type="hidden" name="submitted" id="submitted" value="true" /> <div style="clear:both;"></div> </div> </form> <!-- End Contact Form --> <?php } ?> <?php wp_link_pages('before=<div class="rt-pagination">'._r('Pages:').'&after=</div><br />'); ?> <?php edit_post_link(_r('Edit this entry.'), '<div class="edit-entry">', '</div>'); ?> <!-- End Post Content --> </div> </div> <!-- End Post --> <?php endwhile;?> <?php else : ?> <h2 class="title"> <?php _re('Sorry, no pages matched your criteria.'); ?> </h2> <?php endif; ?> <?php wp_reset_query(); ?> </div> </div> <!-- End Contact Form Template --> </div> <div class="clear"></div> </div> <?php endif; ?> </div> <?php if (isset($fparams->contentBottom)) : ?> <div id="rt-content-bottom"> <?php echo $fparams->contentBottom; ?> </div> <?php endif; ?> </div> <?php echo $fparams->sidebars; ?> <div class="clear"></div> </div> </div> </div> <?php endif; ?> <?php return ob_get_clean(); } }
Сайт на движке WordPress.
При отправке письма с сайта письма - появляется сообщение сто письмо отправлено успешно.