-1

I trying to make a php code where if someone sign ups in to my website, it will automatically sends the welcome mail (php file). but i could n't able to figure it out how to add the mail-php file/body to the php script whiich says

mail ();

My php script as follows::

<?php 
    //15 2 2015
    session_start();
    if(!isset($_SESSION["login"]))
        header("location:logout.php");
?>
<?php include('contactus-freelancer.php'); ?>
<?php include('../db.php'); ?>
<?php
$email = $_SESSION['email'];
$to = "$email";
$subject = "Welcome mail";

mail ('''what goes here is my question'''');

echo '<a href="Home.php"></a>';
?>

My mailing script as followsL::

<?php include('home.php'); ?>
<?php 
    //15 2 2015
    session_start();
    if(!isset($_SESSION["login"]))
        header("location:logout.php");
?>
<?php include('db.php'); ?>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="format-detection" content="telephone=no" /> <!-- disable auto telephone linking in iOS -->
        <title>Respmail is a response HTML email designed to work on all major email platforms and smartphones</title>

    </head>
    <body bgcolor="#E1E1E1" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">

        <center style="background-color:#E1E1E1;">
            <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;">
                <tr>
                    <td align="center" valign="top" id="bodyCell">

                        <table bgcolor="#E1E1E1" border="0" cellpadding="0" cellspacing="0" width="500" id="emailHeader">

                            <!-- HEADER ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="10" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>


                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // END -->

                        </table>

                        <table bgcolor="#FFFFFF"  border="0" cellpadding="0" cellspacing="0" width="500" id="emailBody">



                            <?php 
                                $email = $_SESSION['email'];
                                $sql = "SELECT * FROM fuser WHERE email = '$email' ";
                                $result = $conn->query($sql);
                                if ($result->num_rows > 0) { 

                                while($row = $result->fetch_assoc()) { 

                          ?>

                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <!--
                                        The centering table keeps the content
                                        tables centered in the emailBody table,
                                        in case its width is set to 100%.
                                    -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%" style="color:#FFFFFF;" bgcolor="#3498db">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <!--
                                                    The flexible container has a set width
                                                    that gets overridden by the media query.
                                                    Most content tables within can then be
                                                    given 100% widths.
                                                -->
                                                <table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td align="center" valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <!--
                                                            The content table is the first element
                                                                that's entirely separate from the structural
                                                                framework of the email.
                                                            -->
                                                            <table border="0" cellpadding="30" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top" class="textContent">
                                                                        <h1 style="color:#FFFFFF;line-height:100%;font-family:Helvetica,Arial,sans-serif;font-size:35px;font-weight:normal;margin-bottom:5px;text-align:center;"><small>Hello <?php echo strtoupper ($row["name"]); ?> </small><br> <br>Welcome to GraduateFreelancers</h1>
                                                                        <h2 style="text-align:center;font-weight:normal;font-family:Helvetica,Arial,sans-serif;font-size:23px;margin-bottom:10px;color:#205478;line-height:135%;"><small>OUR JOB IS TO FIND YOU A JOB</small></h2>
                                                                        <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">GraduateFreelancers is India’s one of the growing online career and recruitment resource with its global essencia technology provides relevant profiles to employers and relevant jobs to job-seekers across industry verticals, experience levels and geographies. Best rated by people have registered on the site over largest Indian network.</div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>

                            <tr mc:hideable>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">


                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->




                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#F8F8F8">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td align="center" valign="top" width="500" class="flexibleContainerCell">
                                                            <table border="0" cellpadding="30" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top">

                                                                        <!-- CONTENT TABLE // -->
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                            <tr>
                                                                                <td valign="top" class="textContent">

                                                                                    <h3 mc:edit="header" style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;">Thank You</h3>
                                                                                    <div mc:edit="body" style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-left:-25%; margin-bottom:0;color:#5F5F5F;line-height:135%; width:150%;">Let me take this opportunity to thank you for choosing GraduateFreelancers to provide you the finest opportunities and services. We are proud to welcome satisfied freelancers and look forward to many years of working together.<br><br>If you have any questions about our services, we invite you to get in touch with out customaer care available at <i><b>contact@graduatefreelancers.in</b></i>, and we will be happy to assist you 24/7.</div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                        <!-- // CONTENT TABLE -->

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->


                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="left" valign="top" class="flexibleContainerBox">
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width: 100%;">
                                                                            <tr>
                                                                                <td align="left" class="textContent">
                                                                                    <h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:CENTER; width:130%;">Complete your Profile</h3>
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;">We care about your career more than anyone else, which gives us an opportunity to let you know that a complete profile with uploaded CV gets noticed by Recruiters more than the othere who haven't.</div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                    <td align="right" valign="middle" class="flexibleContainerBox">
                                                                        <table class="flexibleContainerBoxNext" border="0" cellpadding="0" cellspacing="0" width="210" style="max-width: 100%;">
                                                                            <tr>
                                                                                <td align="left" class="textContent">
                                                                                    <h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center; margin-right:-50%; width:180%;">Upload a Profile picture</h3>
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:155%; margin-right:-50%; width:180%;">Recruiters get what they see. And now to help them get to know you better, we requerst you to take a bit effort to upload your profile picture.</div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->


                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr style="padding-top:0;">
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td style="padding-top:0;" align="center" valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table border="0" cellpadding="0" cellspacing="0" width="50%" class="emailButton" style="background-color: #3498DB;">
                                                                <tr>
                                                                    <td align="center" valign="middle" class="buttonContent" style="padding-top:15px;padding-bottom:15px;padding-right:15px;padding-left:15px;">
                                                                        <a style="color:#FFFFFF;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:20px;line-height:135%;" href="www.graduatefreelancers/freelancerssign/" target="_blank">LogIn Here</a>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->
                            <!-- MODULE ROW // -->


                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td align="center" valign="top" width="500" class="flexibleContainerCell">
                                                            <table border="0" cellpadding="30" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top">

                                                                        <!-- CONTENT TABLE // -->
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                            <tr>
                                                                                <td valign="top" class="textContent">
                                                                                    <h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;">Projects Related to your Streams</h3>
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;margin-top:3px;color:#5F5F5F;line-height:135%;">Now let us get to the business. Here are some paid projects recruiters have posted from past two weeks.</div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                        <!-- // CONTENT TABLE -->

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->


                            <!-- MODULE DIVIDER // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td align="center" valign="top" width="500" class="flexibleContainerCell">
                                                            <table class="flexibleContainerCellDivider" border="0" cellpadding="30" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top" style="padding-top:0px;padding-bottom:0px;">

                                                                        <!-- CONTENT TABLE // -->
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                            <tr>
                                                                                <td align="center" valign="top" style="border-top:1px solid #C8C8C8;"></td>
                                                                            </tr>
                                                                        </table>
                                                                        <!-- // CONTENT TABLE -->

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // END -->



                            <?php 
                                $category1 = $row["category1"];
                                $sql2 = "SELECT * FROM input WHERE category1 = '$category1' ORDER BY date DESC LIMIT 2";
                                $result2 = $conn->query($sql2);
                                if ($result2->num_rows > 0) { 

                                while($row2 = $result2->fetch_assoc()) { 

                            ?>



                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="left" valign="top" class="flexibleContainerBox">
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width:100%;">
                                                                            <tr>
                                                                                <td align="left" class="textContent">
                                                                                    <h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:10px;margin-bottom:3px;text-align:center; width:130%; margin-left:10%;"><?php echo ($row2["title"]); ?></h3>
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%; margin-left:10%;"><?php echo ($row2["description"]); ?></div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>

                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->



                            <?php     }
                             } else {
                                echo "0 results";
                                    }
                            ?>

                            <?php 
                                $category2 = $row["category2"];
                                $sql3 = "SELECT * FROM input WHERE category1 = '$category2' ORDER BY date DESC LIMIT 2";
                                $result3 = $conn->query($sql3);
                                if ($result3->num_rows > 0) { 

                                while($row3 = $result3->fetch_assoc()) { 

                            ?>

                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="30" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="left" valign="top" class="flexibleContainerBox">
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="210" style="max-width:100%;">
                                                                            <tr>
                                                                                <td align="left" class="textContent">
                                                                                    <h3 style="color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:10px;margin-bottom:3px;text-align:center; width:130%; margin-left:10%;"><?php echo ($row3["title"]); ?></h3>
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;margin-left:10%;"><?php echo ($row3["description"]); ?></div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>

                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->



                            <!-- // END -->

                            <?php     }
                             } else {
                                echo "0 results";
                                    }
                            ?>

                            <?php     }
                                 } else {
                                    echo "0 results";
                                        }
                                    $conn->close();
                            ?>





                            <!-- MODULE ROW // -->
                            <tr>
                                <td align="center" valign="top">
                                    <!-- CENTERING TABLE // -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td align="center" valign="top">
                                                <!-- FLEXIBLE CONTAINER // -->
                                                <table border="0" cellpadding="0" cellspacing="0" width="500" class="flexibleContainer">
                                                    <tr>
                                                        <td valign="top" width="500" class="flexibleContainerCell">

                                                            <!-- CONTENT TABLE // -->
                                                            <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top" class="flexibleContainerBox" style="background-color:#5F5F5F;">
                                                                        <table border="0" cellpadding="30" cellspacing="0" width="100%" style="max-width:100%;">
                                                                            <tr>
                                                                                <td align="center" class="textContent">
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">How are we doing. Please take a moment to give us your feed back.</div><br>
                                                                                    <h3 style="color:#FFFFFF;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;"><b>FEED BACK</b></h3>                                                                                 
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                    <td align="center" valign="top" class="flexibleContainerBox" style="background-color:#27ae60;">
                                                                        <table class="flexibleContainerBoxNext" border="0" cellpadding="30" cellspacing="0" width="100%" style="max-width:100%;">
                                                                            <tr>
                                                                                <td align="center" class="textContent">
                                                                                    <div style="text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;">Are we doing good?. Please let your Appreciation reach us.</div><br>
                                                                                    <h3 style="color:#FFFFFF;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;"><b>DONATE</b></h3>                                                                                    
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <!-- // CONTENT TABLE -->

                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                            <!-- // MODULE ROW -->





                    </td>
                </tr>
            </table>
        </center>
    </body>
</html>

NOTE: i have to get the whole mailing script as mail to the user who signs up Any Suggestions are Appreciated..

harishk
  • 418
  • 5
  • 21
  • what do you want that not clearly understand. can you describe in details. – Yagnik Detroja Oct 03 '16 at 09:38
  • assign your body to one variable on the php file i.e $msg="whole body here"; then include that file before the mail function and you can get the $msg – Yagnik Detroja Oct 03 '16 at 09:40
  • say, you sign up in my site.. the site will automatically send a welcome mail to you mail id...here i have the mail in .php code.. but the php required to make the action to send a mail to your mail id is having a problem.. say my welcome mail has text of "hi" in it.. now i m supposed to add that file to the above mentioned code.? – harishk Oct 03 '16 at 09:41
  • i tried that... you were saying to add like ....`mail (my whole mail body);` but my mail body has lot of double apostrophes, which are messing with the mail tag.. like `mail()` – harishk Oct 03 '16 at 09:44
  • Possible duplicate of [How to send an email using PHP?](http://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php) - Please do some research before asking on SO, there are both plenty of questions covering this but also PLENTY of tutorials on how to send emails – Epodax Oct 03 '16 at 09:48
  • @Epodax check up both questions before commenting dude.. that question is about how to make a contact form.. mine is different... Please be prudent while commenting.. – harishk Oct 03 '16 at 09:52
  • I'm not gonna bother, please do your own research, we're not gonna do it for you, there's plenty of guides / manuals / tutorials out there on how to send emails, which covers what you need to put inside of `mail()` (which my linked question also does). – Epodax Oct 03 '16 at 09:55
  • @YagnikDetroja shoud i be echo ing the who mail script inside the mail()? – harishk Oct 03 '16 at 09:58
  • NO You can't but @harishk i am also agree with the Epodax. I am not getting what you want to try it's just mail function. what was confusing there and what you want to send. main thing what you tried. – Yagnik Detroja Oct 03 '16 at 10:03
  • @YagnikDetroja you sign up , you get a welcome mail... thats it.. and i have the mail design with me... now how can i send it to you, when you sign up .. – harishk Oct 03 '16 at 10:16
  • When you fill the sign up form and then where you get the all data of form and you insert the it in database. now after that just put on mail function. i.e http://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php send in this file. You can see the all data when Print_r the $_request[]; just get email address from that. – Yagnik Detroja Oct 03 '16 at 10:24
  • NO... @YagnikDetroja you didn't get me.. wait.. check the question update.. that is how my mailing code luks like.. its both php and html.. now i can't keep all that code in `mail()`... right..? – harishk Oct 03 '16 at 10:45

2 Answers2

1

Man I'm not sure if you also know what you want, On your question you ask how to send email when a use signs up on your system, but the code you pasted here, have nothing to do with signing up.

From reading the comments, I assume that you want to send an email with html template. I tried to work on your code but it's too long I just did the first 300 lines the rest you can finish it by yourself, here:

        <?php 


             $headers = "MIME-Version: 1.0" . "\r\n";
             $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // set content type to html
             $headers = "From: Your System Name <no-reply@your-system.com> \r\n";




             $message  = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\" width=\"100%\" id=\"bodyTable\" style=\"table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;\" align=\"center\">";
             $message .="<tr>";
             $message .="<td align=\"center\" valign=\"top\" id=\"bodyCell\">";
             $message .="<table bgcolor=\"#E1E1E1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" id=\"emailHeader\">";
                    // HEADER ROW
                      $message .="<tr>";
                        $message .="<td align=\"center\" valign=\"top\">";
                               // CENTERING TABLE 
                         $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
                        $message .="<tr>";
                        $message .="<td align=\"center\" valign=\"top\">";
                                           // FLEXIBLE CONTAINER 
                         $message .= "<table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
                                                $message .= "<tr>";
                                                    $message .="<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";

                                                      // CONTENT TABLE // 
                                                       $message .="<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
                                                       $message .="<tr>";


                                                       $message .="</tr>";
                                                        $message .="</table>";
                                                    $message .="</td>";
                                                $message .="</tr>";
                                            $message .="</table>";
                                            // FLEXIBLE CONTAINER
                                        $message .="</td>";
                                    $message .="</tr>";
                                $message .="</table>";
                              // CENTERING TABLE
                           $message .="</td>";
                        $message .="</tr>";
                        // END

                    $message .="</table>";

                    $message .="<table bgcolor=\"#FFFFFF\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" id=\"emailBody\">";




                            $email = $_SESSION['email'];
                            $sql = "SELECT * FROM fuser WHERE email = '$email' ";
                            $result = $conn->query($sql);
                            if ($result->num_rows > 0) { 

                            while($row = $result->fetch_assoc()) { 


                          $message .="<tr>";
                          $message .="<td align=\"center\" valign=\"top\">";
                                //CENTERING TABLE
                                /*
                                    The centering table keeps the content
                                    tables centered in the emailBody table,
                                    in case its width is set to 100%.
                              */
                                $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"color:#FFFFFF;\" bgcolor=\"#3498db\">";
                                $message .="<tr>";
                                $message  .="<td align=\"center\" valign=\"top\">";

                                            /* FLEXIBLE CONTAINER 

                                                The flexible container has a set width
                                                that gets overridden by the media query.
                                                Most content tables within can then be
                                                given 100% widths.
                                            */

                                           $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
                                           $message .="<tr>";
                                           $message .="<td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";

                                                /*   CONTENT TABLE // -->
                                                        <!--
                                                        The content table is the first element
                                                            that's entirely separate from the structural
                                                            framework of the email.
                                                     */
                                                       $message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">";
                                                          $message .="<tr>";
                                                         $message .="<td align=\"center\" valign=\"top\" class=\"textContent\">";
                                                        $message .="<h1 style=\"color:#FFFFFF;line-height:100%;font-family:Helvetica,Arial,sans-serif;font-size:35px;font-weight:normal;margin-bottom:5px;text-align:center;\"><small>Hello".strtoupper($row['name'])."</small><br> <br>Welcome to GraduateFreelancers</h1>";

                                                        $message .="<h2 style=\"text-align:center;font-weight:normal;font-family:Helvetica,Arial,sans-serif;font-size:23px;margin-bottom:10px;color:#205478;line-height:135%;\"><small>OUR JOB IS TO FIND YOU A JOB</small></h2>";
                                                        $message .="<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#FFFFFF;line-height:135%;\">GraduateFreelancers is India’s one of the growing online career and recruitment resource with its global essencia technology provides relevant profiles to employers and relevant jobs to job-seekers across industry verticals, experience levels and geographies. Best rated by people have registered on the site over largest Indian network.</div>";
                                                                $message .="</td>";
                                                            $message .="</tr>";
                                                        $message .="</table>";
                                                      // CONTENT TABLE 

                                                    $message .="</td>";
                                                $message .="</tr>";
                                            $message .="</table>";
                                            // FLEXIBLE CONTAINER
                                        $message .="</td>";
                                    $message .="</tr>";
                                $message .="</table>";
                               // CENTERING TABLE
                            $message .="</td>";
                        $message.= "</tr>";

                        $message .="<tr mc:hideable>";
                        $message .="<td align=\"center\" valign=\"top\">";
                                // CENTERING TABLE
                         $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
                                    $message .="<tr>";
                                        $message .="<td align=\"center\" valign=\"top\">";
                                            //FLEXIBLE CONTAINER
                                            $message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
                                                $message .="<tr>";
                                                    $message .="<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";


                                                       // CONTENT TABLE

                                                    $message .="</td>";
                                                $message .="</tr>";
                                            $message .="</table>";
                                             // FLEXIBLE CONTAINER
                                        $message .="</td>";
                                    $message .="</tr>";
                                $message .="</table>";
                                 // CENTERING TABLE
                            $message.="</td>";
                        $message .="</tr>";
                      // MODULE ROW




              // MODULE ROW //
                        $message .="<tr>";
                            $message .="<td align=\"center\" valign=\"top\">";
                                //CENTERING TABLE //
                                $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#F8F8F8\">";
                                $message.="<tr>";
                                        $message .="<td align=\"center\" valign=\"top\">";
                                            // FLEXIBLE CONTAINER
                                            $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
                                            $message .="<tr>";
                                                    $message .="<td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
                                                       $message .="<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">";
                                                            $message.="<tr>";
                                                                $message .="<td align=\"center\" valign=\"top\">";

                                                                   // CONTENT TABLE
                                                                    $message .="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
                                                                        $message .="<tr>";
                                                                            $message .="<td valign=\"top\" class=\"textContent\">";

                                                                                $message .="<h3 mc:edit=\"header\" style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;\">Thank You</h3>
                                                                                <div mc:edit=\"body\" style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-left:-25%; margin-bottom:0;color:#5F5F5F;line-height:135%; width:150%;\">Let me take this opportunity to thank you for choosing GraduateFreelancers to provide you the finest opportunities and services. We are proud to welcome satisfied freelancers and look forward to many years of working together.<br><br>If you have any questions about our services, we invite you to get in touch with out customaer care available at <i><b>contact@graduatefreelancers.in</b></i>, and we will be happy to assist you 24/7.</div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                  // CONTENT TABLE -->

                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                            <!-- // FLEXIBLE CONTAINER -->
                                        </td>
                                    </tr>
                                </table>
                                <!-- // CENTERING TABLE -->
                            </td>
                        </tr>";
                     // MODULE ROW -->


                        // <!-- MODULE ROW // -->
                       $message.="<tr>
                            <td align=\"center\" valign=\"top\">
                                <!-- CENTERING TABLE // -->
                                <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
                                    <tr>
                                        <td align=\"center\" valign=\"top\">
                                            <!-- FLEXIBLE CONTAINER // -->
                                            <table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
                                                <tr>
                                                    <td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">

                                                        <!-- CONTENT TABLE // -->
                                                        <table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
                                                            <tr>
                                                                <td align=\"left\" valign=\"top\" class=\"flexibleContainerBox\">
                                                                    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">
                                                                        <tr>
                                                                            <td align=\"left\" class=\"textContent\">
                                                                                <h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:CENTER; width:130%;\">Complete your Profile</h3>
                                                                                <div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:135%; width:130%;\">We care about your career more than anyone else, which gives us an opportunity to let you know that a complete profile with uploaded CV gets noticed by Recruiters more than the othere who haven't.</div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                                <td align=\"right\" valign=\"middle\" class=\"flexibleContainerBox\">
                                                                    <table class=\"flexibleContainerBoxNext\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">
                                                                        <tr>
                                                                            <td align=\"left\" class=\"textContent\">
                                                                                <h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center; margin-right:-50%; width:180%;\">Upload a Profile picture</h3>
                                                                                <div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;color:#5F5F5F;line-height:155%; margin-right:-50%; width:180%;\">Recruiters get what they see. And now to help them get to know you better, we requerst you to take a bit effort to upload your profile picture.</div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        <!-- // CONTENT TABLE -->

                                                    </td>
                                                </tr>
                                            </table>
                                            <!-- // FLEXIBLE CONTAINER -->
                                        </td>
                                    </tr>
                                </table>
                                <!-- // CENTERING TABLE -->
                            </td>
                        </tr>";
                       // MODULE ROW -->

                     // MODULE ROW //
                        $message .="<tr>
                            <td align=\"center\" valign=\"top\">

                                <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
                                    <tr style=\"padding-top:0;\">
                                        <td align=\"center\" valign=\"top\">

                                            <table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
                                                <tr>
                                                    <td style=\"padding-top:0;\" align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">

                                                        <!-- CONTENT TABLE // -->
                                                        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\" class=\"emailButton\" style=\"background-color: #3498DB;\">
                                                            <tr>
                                                                <td align=\"center\" valign=\"middle\" class=\"buttonContent\" style=\"padding-top:15px;padding-bottom:15px;padding-right:15px;padding-left:15px;\">
                                                                    <a style=\"color:#FFFFFF;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:20px;line-height:135%;\" href=\"www.graduatefreelancers/freelancerssign/\" target=\"_blank\">LogIn Here</a>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        <!-- // CONTENT TABLE -->

                                                    </td>
                                                </tr>
                                            </table>
                                            <!-- // FLEXIBLE CONTAINER -->
                                        </td>
                                    </tr>
                                </table>
                                <!-- // CENTERING TABLE -->
                            </td>
                        </tr>";
                       // MODULE ROW -->
                        // MODULE ROW // -->


                        // MODULE ROW // -->
                       $message .="<tr>
                            <td align=\"center\" valign=\"top\">
                                <!-- CENTERING TABLE // -->
                                <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
                                    <tr>
                                        <td align=\"center\" valign=\"top\">
                                            <!-- FLEXIBLE CONTAINER // -->
                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">
                                                <tr>
                                                    <td align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">
                                                        <table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\">
                                                            <tr>
                                                                <td align=\"center\" valign=\"top\">

                                                                    <!-- CONTENT TABLE // -->
                                                                    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
                                                                        <tr>
                                                                            <td valign=\"top\" class=\"textContent\">
                                                                                <h3 style=\"color:#5F5F5F;line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;text-align:center;\">Projects Related to your Streams</h3>
                                                                                <div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;margin-top:3px;color:#5F5F5F;line-height:135%;\">Now let us get to the business. Here are some paid projects recruiters have posted from past two weeks.</div>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                    <!-- // CONTENT TABLE -->

                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                            <!-- // FLEXIBLE CONTAINER -->
                                        </td>
                                    </tr>
                                </table>
                                <!-- // CENTERING TABLE -->
                            </td>
                        </tr>";




                        mail($email, "Welcome", $message,$headers);
                        ?>

And also I would suggest that you use PDO prepared statements. let me know if the code doesn't make sense to you.

Masivuye Cokile
  • 4,754
  • 3
  • 19
  • 34
  • well, i have a seperate code for sign up .. i didn't mentioned in the question... although your answer makes sense to me.. i have a small doubt like. in any php case.. if you define a variable like `$name='xxx';` and in the next like you define the another variable with the same name. like `$name='yyy';` the first written value of $name will be overwritten right.. ? if i m right.. please explain me how multiple $message variables are gonna work. Thanks.. – harishk Oct 03 '16 at 12:49
  • $message = "hellow"; $message .= "World"; Check the operators " .= " you use when you combine strings, basically what it does it concatenate the multiple $message variables you see into a one variable. Hope that answers your question – Masivuye Cokile Oct 03 '16 at 12:56
  • one more thing. you used "/" when there is a requirement of double quotation back to back.. noted.. and if i made the whole script the way you made those 300 lines.. will the code executes itself itself as a HTML page in the mail?... like... if you have script like, $message = "Hello" .. it should show in the mail as 'Hello;...... i know its a dumb question, but still, i would like to hear it..Thanks – harishk Oct 03 '16 at 13:05
  • It will execute as html in the email.... But you have to set content type as html in your email headers, or else it will be treated as plain text. $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // set content type to html. Don't forget to up vote for my answer and mark it helpful if you found it helpful – Masivuye Cokile Oct 03 '16 at 13:08
  • i have another doubt,, like why cant we do it for multiple line.. like.. $message = " line 1 line 2 line3 "; @MasivuyeCokile – harishk Oct 03 '16 at 14:37
  • I don't think I understand your question. – Masivuye Cokile Oct 03 '16 at 14:41
  • i mean $messege= for all the lines of code,instead of putting $meesege= for every single line – harishk Oct 03 '16 at 15:23
  • well you can do that as well. – Masivuye Cokile Oct 03 '16 at 15:32
0

You can use this for reference, refer the section "Sending HTML Email". As of your question mail ('''what goes here is my question'''');

PHP mail function is formatted as

mail($to, $subject, $message, $headers);

Please check the PHP doc for mail function for more readings.

Chris Laconsay
  • 402
  • 1
  • 3
  • 17
  • hi @ChristopherLaconsay i presume you understood my question.. here, if i use your code. i will get a mail where the only body will be"to, sub,msg, head.." but i need the above posted 'Mail Script' as the body.. please revert if you didn't understood. thanks you.. – harishk Oct 03 '16 at 11:14
  • 1
    I'm not sure if I understand your question correctly, basically, if you want to send HTML, you just have to find a way to store it on a variable (e.g $message) and pass it to the mail function. You will see how it is done if you read the link I gave you. – Chris Laconsay Oct 03 '16 at 11:44
  • I understood. as you can see, i have a whole lot of html code (mentioned in question).. so what should i do? – harishk Oct 03 '16 at 11:58