Its a complete similar question of http://stackoverflow.com/questions/39828548/welcome-mail-php-when-someone-signups
but with updated issues.. please go through the mentioned link for more information.
I m trying to send a welcome mail to the user who signin to my website.
When the user enters his details in the signup form the submit posts it to 'logincheck.php' where after it checks the login details, it will redirect the page to 'automail.php' where the mail script exists. then the automail.php redirects it to 'home.php'..
Now the problem is, after, logincheck, the page redirects to automail.php, where it ceases and shows blank page.
AUTOMAIL.PHP ::
<?php include('home.php'); ?>
<?php
//15 2 2015
session_start();
if(!isset($_SESSION["login"]))
header("location:logout.php");
?>
<?php include('db.php'); ?>
<?php
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers = "From: Your System Name <no-reply@your-system.com> \r\n";
$email = $_SESSION['email'];
$to = "$email";
$subject = "Welcome to Home";
$message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$message .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$message .= "<head>";
$message .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
$message .= "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">";
$message .= "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">";
$message .= "<meta name=\"format-detection\" content=\"telephone=no\" />";
$message .= "<title>the automail</title>";
$message .= "</head>";
$message .= "<body bgcolor=\"#E1E1E1\" leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" offset=\"0\">";
$message .= "<center style=\"background-color:#E1E1E1;\">";
$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;\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\" id=\"bodyCell\">";
$message .= "<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()) {
?>
$message .= "<tr mc:hideable>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$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 -->
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<!-- CENTERING TABLE // -->";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .= "<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"left\" valign=\"top\" class=\"flexibleContainerBox\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">";
$message .= "<tr>";
$message .= "<td align=\"left\" class=\"textContent\">";
$message .= "<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>";
$message .= "<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>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$message .= "</td>";
$message .= "<td align=\"right\" valign=\"middle\" class=\"flexibleContainerBox\">";
$message .= "<table class=\"flexibleContainerBoxNext\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width: 100%;\">";
$message .= "<tr>";
$message .= "<td align=\"left\" class=\"textContent\">";
$message .= "<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>";
$message .= "<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>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$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>";
<!-- // MODULE ROW -->
<?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()) {
?>
$message .=" <tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .= "<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"left\" valign=\"top\" class=\"flexibleContainerBox\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width:100%;\">";
$message .= "<tr>";
$message .= "<td align=\"left\" class=\"textContent\">";
$message .= "<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%;\">".($row2['title'])."</h3>";
$message .= "<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%;\">".($row2['description'])."</div>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$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>";
<?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()) {
?>
$message .=" <tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .= "<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"left\" valign=\"top\" class=\"flexibleContainerBox\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"210\" style=\"max-width:100%;\">";
$message .= "<tr>";
$message .= "<td align=\"left\" class=\"textContent\">";
$message .= "<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%;\">".($row3['title'])."</h3>";
$message .= "<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%;\">".($row3['description'])."</div>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$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>";
<!-- // MODULE ROW -->
<?php }
} else {
echo "0 results";
}
?>
<?php }
} else {
echo "0 results";
}
?>
$message .=" <tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td style=\"padding-top:0;\" align=\"center\" valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .= "<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td align=\"left\" valign=\"top\" class=\"textContent\">";
$message .= "<div style=\"text-align:center;font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;margin-top:10px;color:#5F5F5F;line-height:135%; margin-right: -30%;\">We know you aren't satisfied with these. <br> Lets go back to our website, Browse through hundreds of projecs and let us help you find a better project. </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>";
<!-- // MODULE ROW -->
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= " <tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"flexibleContainer\">";
$message .= "<tr>";
$message .= "<td valign=\"top\" width=\"500\" class=\"flexibleContainerCell\">";
$message .= "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\" class=\"flexibleContainerBox\" style=\"background-color:#5F5F5F;\">";
$message .= "<table border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\" style=\"max-width:100%;\">";
$message .= "<tr>";
$message .= "<td align=\"center\" class=\"textContent\">";
$message .= "<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>";
$message .= "<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>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$message .= "</td>";
$message .= "<td align=\"center\" valign=\"top\" class=\"flexibleContainerBox\" style=\"background-color:#27ae60;\">";
$message .= "<table class=\"flexibleContainerBoxNext\" border=\"0\" cellpadding=\"30\" cellspacing=\"0\" width=\"100%\" style=\"max-width:100%;\">";
$message .= "<tr>";
$message .= "<td align=\"center\" class=\"textContent\">";
$message .= "<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>";
$message .= "<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>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$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>";
<!-- // MODULE ROW -->
$message .= "<table bgcolor=\"#E1E1E1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" id=\"emailFooter\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$message .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$message .= "<tr>";
$message .= "<td align=\"center\" valign=\"top\">";
$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 valign=\"top\" bgcolor=\"#E1E1E1\">";
$message .= "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:13px;color:#828282;text-align:center;line-height:120%;\">";
$message .= "<div>Copyright © 2014 <a href=\"http://www.charlesmudy.com/respmail/\" target=\"_blank\" style=\"text-decoration:none;color:#828282;\"><span style=\"color:#828282;\">Respmail</span></a>. All rights reserved.</div>";
$message .= "<div>If you do not want to recieve emails from us, you can <a href=\"#\" target=\"_blank\" style=\"text-decoration:none;color:#828282;\"><span style=\"color:#828282;\">unsubscribe</span></a>.</div>";
$message .= "</div>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
<!-- // FLEXIBLE CONTAINER -->
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
<!-- // CENTERING TABLE -->
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
<!-- // END -->
$message .= "</td>";
$message .= "</tr>";
$message .= "</table>";
$message .= "</center>";
$message .= "</body>";
$message .= "</html> ";
<?php
mail ($to, $subject, $message);
echo '<a href="freelancer.php"></a>';
$conn->close();
?>
Any Help is greatly Appreciated.... If you find the question subtle to understand, please comment, will try mybest to explain.