Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Форма отправки сообщения на e-mail

Recommended Posts

Добрый день!

Скажите, почему не отправляется письмо на мыло, а просто обновляется страничка:


if(isset($_POST['email'])) {
    $email_to = "admin@supershkaf.com.ua";
    $email_subject = "Заявочка!!! ))";
    function errorMesg() {
        // Error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
    // validation expected data exists
    if(!isset($_POST['name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['comments'])) {
    $name = $_POST['name']; // required
    $email_from = $_POST['email']; // required
    $comments = $_POST['comments']; // required
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    $email_message .= "Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  



<form name="contact" method="post" >
                                <div class="span3">
                                    <input type="text" value="Имя" id="name" name="name" class="span3"
                                onfocus="if(this.value == 'Имя') {this.value = '';}"    
                                onblur="if (this.value == '') {this.value = 'Имя';}" />
                                <div class="span6">
                                    <input type="text" value="Email" id="email" name="email" class="span3"  
                                onfocus="if(this.value == 'Email') {this.value = '';}"  
                                onblur="if (this.value == '') {this.value = 'Email';}" />

                                <div class="span6">
                                    <textarea cols="30" rows="5" id="comments" name="comments" class="span6"    
                                onfocus="if(this.value == 'Комментарии...') {this.value = '';}"
                                onblur="if (this.value == '') {this.value = 'Комментарии...';}">Комментарии...</textarea>

                                <div class="span6">
                                    <button type="submit" id="email_submit"  class="button alignLeft">ОТПРАВИТЬ</button>                                  
                                    <div id="reply_message" >Сообщение успешно отправленно</div>

Link to post
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.