4 replies [Last post]
jansch
jansch's picture
Offline
newbie
Last seen: 4 years 36 weeks ago
Timezone: GMT+1
Joined: 2016-02-04
Posts: 4
Points: 6

I have spent many and many hours trying to guess (discover:-)) how to set up the destination e-mail address for this template.

Can you please kindly help me?
Please, keep in mind that I am not professional Smile - I would welcome a step-by-step easy-to-understand instructions.
Very many thanks in advance.
Jan

jansch
jansch's picture
Offline
newbie
Last seen: 4 years 36 weeks ago
Timezone: GMT+1
Joined: 2016-02-04
Posts: 4
Points: 6

Added the link to the template

lucky ali
Offline
newbie
Last seen: 4 years 37 weeks ago
Timezone: GMT+5
Joined: 2016-02-05
Posts: 1
Points: 2

my pleasure to help you with setting email

Hi, setting destination email is easy. it just need a little bit of coding.

First you need to make a little changes to the contact form.

1. add a name attribute to email field like name="email"
2. change password field and label to name and add name attribute like name="username"
3. add name attribute to message textarea like name="message"
4. change to

Now you have to create a php file with name "form_action.php" in you public_html or in the same folder your html file is in. and put the code.

<?php
         $to = "[email protected]";
         $subject = "Email from ".$_POST['username'];
 
         $message = $_POST['message'];
 
 
         $header = "From:".$_POST['email']." \r\n"; 
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";
 
         $retval = mail ($to,$subject,$message,$header);
 
         if( $retval == true ) {
            echo "Message sent successfully...";
 
         }else {
            echo "Message could not be sent...";
         }
      ?>

Good luck.
You may contact me on

if you need further help.

jansch
jansch's picture
Offline
newbie
Last seen: 4 years 36 weeks ago
Timezone: GMT+1
Joined: 2016-02-04
Posts: 4
Points: 6

Thank you very much for the

Thank you very much for the detailed information!
I understand your instructions about creating the php file.
But unfortunately I do not understand the instructions for editing the contact form (I have not even programming basics:-) So can you please be so good to edit the form code for me?
Below is the ORIGINAL (not edited by me) contact form code:

                    <form>
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">Email address</label>
                                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="exampleInputPassword1">Password</label>
                                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">Message</label>
                            <textarea class="form-control" rows="3"></textarea>
                        </div>
 
                        <button type="submit" class="btn tf-btn btn-default">Submit</button>
                    </form>

Also very important:
I do not want the password and username fields to be present on the page. Can you pls adapt both the contact form and the php file code so that there will only be 2 boxes: e-mail address (of the sender) and the message?

Also another topic: I read through some tutorial on teh web and found out that some solutions may not work in some browser. Is this true?
Very many thanks again!
Jan

lucky ali
Offline
newbie
Last seen: 4 years 37 weeks ago
Timezone: GMT+5
Joined: 2016-02-05
Posts: 1
Points: 2

form changes

<form method="post" action="form_action.php">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">Email address</label>
                                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" name="email">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="exampleInputPassword1">Name</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" placeholder="Name" name="username">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">Message</label>
                            <textarea class="form-control" rows="3" name="message"></textarea>
                        </div>
 
                        <button type="submit" class="btn tf-btn btn-default">Submit</button>
                    </form>