Announcement

Collapse
No announcement yet.

mail script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • mail script

    Kindly check this php script whether it has the ability to send mail, If no then can you please modify the same if you have some time. Also I need it to redirected to a "thankyou.html" page after sending the mail. Here is the script :-
    Code:
    <?php
    
    
    $to = "anyone@outlook.com";
    
    $subject = "Message From Marriage Matchmakers Job";
    
    
    $requiredFirstName = $_POST['requiredFirstName'];
    
    
    $strEmail = $_POST['strEmail'];
    
    $strPhone = $_POST['strPhone'];
    $strMessage = $_POST['message'];
    
    
    
    
    
    $headers = "From: ". $requiredFirstName . " " . $requiredLastName . "<" . $strEmail . ">\r\n";
    $headers .= "Reply-To: " . $strEmail . "\r\n";
    $headers .= "Return-path: ". $strEmail;
    
    
    
    //how to the information will appear in your email
    //$msg = "\r\nFirstName: " .$requiredFirstName;
    //$msg .= "\r\nLastName: " .$requiredLastName;
    //$msg .= "\r\nEmail: " .$strEmail;
    
    $msg .= "\r\nFirst Name: ".$requiredFirstName."\nEmail: ".$strEmail."\nPhone: ".$strPhone."\nMessage:".$message;
    
    
    
    if (mail($to,$subject,$msg,$headers)) {
    
      echo "Thank You\nYour message has been successfully sent.";
    
    } else {
    
      echo "Error!\n Attention, an error occurred. All the fields are mandatory. Please check and try again.";
    
    }
    
    mail($to,$subject,$msg,$headers);
    
    
    ?>
    Here is the form

    Code:
      <form name="sentMessage" id="contactForm" novalidate>
                            <div class="row control-group">
                                <div class="form-group col-xs-12 floating-label-form-group controls">
                                    <label>Name</label>
                                    
                                    
                                    <input name="requiredFirstName" id="requiredFirstName"   type="text">
                                    
                                    <p class="help-block text-danger"></p>
                                </div>
                            </div>
                            <div class="row control-group">
                                <div class="form-group col-xs-12 floating-label-form-group controls">
                                    <label>Email Address </label>
                                    
                                    <input name="strEmail" id ="strEmail"  type="text">
                                    
                                    <p class="help-block text-danger"></p>
                                </div>
                            </div>
                            <div class="row control-group">
                                <div class="form-group col-xs-12 floating-label-form-group controls">
                                    <label>Phone Number</label>
                                    
                                    <input name="tel"  id ="tel"  type="text">
                                    <p class="help-block text-danger"></p>
                                </div>
                            </div>
                            <div class="row control-group">
                                <div class="form-group col-xs-12 floating-label-form-group controls">
                                    <label>Message</label>
                                    <textarea rows="5" cols="250" input name="message"   id="message" "></textarea>
                                    <p class="help-block text-danger"></p>
                                </div>
                            </div>
                            <br>
                            <div id="success"></div>
                            <div class="row">
                                <div class="form-group col-xs-12">
                                    <button type="submit" class="btn btn-success btn-lg">Send</button>
                                </div>
                            </div>
                        </form>
    It has another problem, after putting the text in the required field though I refresh the page the input field do not reset to its original state ( means the previous input test is there )

    Thanks.


  • #2
    Hi there trnghosh,

    I thought that we had sorted out your contact form problems.


    ~ the original bald headed old fart ~

    Comment


    • #3
      Oh sir it is another one.Actually the person for whom I was working is a strict person ( elder than me) and he told me that make it just html and don't make it contact.php like this and after sending mail it must go to any kind of thank you page and after some time back to the contact page/ index page with nothing in the mail form and all the field must be blank. You know my php knowledge is <? php ....?> So could not sort this one. Get one from net and try to modify it with javascript validation ( as this man do not like to make it php). You have solved my contact form with no problem and do not like to disturb you each time.

      Comment


      • #4
        Hi there trnghosh,

        No, I cannot help you with this stupidity.

        Server-side processing is essential email contact forms.

        PHP form validation is still essential even if JavaScript is also used.

        Not everyone has JavaScript enabled.

        By what method does this guy think that emails are going to be sent to him?


        ~ the original bald headed old fart ~

        Comment


        • #5
          The guy need this one like this :- After clicking the submit button the forms containing the data will be processed through another php script ( mail.php which is in the folder as well ) and he gets the mail through this php mail script, and the page directed to a thank you page and after some time it redirected to the index page. This is his concept. He insist on this one because he has only one page site with top part about him, and the lower part one contact form that's all. He does not like to change this index.html to index.php so I also could not understand how to validate the contact form fields with php. This is the problem with this one. However many many thanks for the help.

          Comment

          Working...
          X