Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 // -->
                                               

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
636 views
Welcome To Ask or Share your Answers For Others

1 Answer

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" . "
";
             $headers .= "Content-type:text/html;charset=UTF-8" . "
"; // set content type to html
             $headers = "From: Your System Name <no-reply@your-system.com> 
";




             $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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...