I am trying out the php mail service getting the variable from DB and then insert the value to HTML to test I am was trying out something like this:
<?php
include("db/dbvalue.php");
include("emailfun/email.php");
$response = array();
$emailaddress = "probh@pro.com";
$dt = new DateTime();
echo $dt->format('m-d');
$m = $dt->format('m');
$d = $dt->format('d');
$result = mysql_query("SELECT * FROM nameValue WHERE type = 'Boys' AND month = '$m' AND date = '$d'");
if (mysql_num_rows($result) > 0)
{
while ($row = mysql_fetch_array($result))
{
$name = $row["name"];
$to= $emailaddress;
$subject ="Congratulations";
$message="
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Name goes here: <?php echo $name; ?> </p>
</body>
</html>
";
$from = "mailsender@pro.com";
$fromname = "Mail Sender";
send_html_mail($to, $subject, $message, $from, $fromname);
}
}
else
{
echo("NOTHING TODAY");
}
?>
I am receiving the mail but just with "Name goes here:"
I am not able to get the variable inserted in the html at all.
Can somebody help me fix this?
Thanks!