PHP Send HTML Email Table Format Template

PHP Send HTML Email Table Format Template

Today, We want to share with you PHP Send HTML Email Table Format Template.
In this post we will show you PHP Send HTML Email with Table Format, hear for Send Beautiful HTML Email using PHP we will give you demo and example for implement.
In this post, we will learn about how to send email in php with html format with an example.

Read Also:  Removing file extensions using htaccess

in this post will show you how to PHP Send HTML Email with Table Format example

require 'include/config.php';

$NewDate=Date('M j, Y', strtotime("+15 days"));
$sql = "SELECT * FROM mtto";
$result = $conn->query($sql);


$to = "[email protected]";
//$to = "[email protected]";
$subject = "Dreams pakainfo Notification";

$message ="Dear ".$to;
$message .= "
<html>
<head>
<title>Dreams pakainfo PHP Get Email With Table</title>
</head>
<body>
<h3>Dreams pakainfo</h3>
<table border='1'>
<tr>
<th>Sr.No</th>
<th>Date</th>
<th>DescripciĆ³n</th>
<th>Fecha inicial</th>
<th>Periodicidad</th>
<th>F Control 1</th>
<th>F Control 2</th>
<th>F Control 3</th>
</tr>";


if ($result->num_rows > 0) 
{ 
$results = array();
	$i = 1;
	while($row = $result->fetch_assoc()) 
	{
		if($NewDate==$row["fecha_1"] || $NewDate==$row["fecha_2"] || $NewDate==$row["fecha_3"])
		{
			
			 $results[] = $row;
			 $message .="<tr>";
			 $message .="<td>".$i."</td>";
			 $message .="<td>". date("M j, Y", strtotime($row['date_time']))."</td>";
			 $message .="<td>".$row["descr"]."</td>";
			 $message .="<td>".date("M j, Y", strtotime($row['fecha_inicial']))."</td>";
			 $message .="<td>".$row["period"]."</td>";
			 $message .="<td>".$row["fecha_1"]."</td>";
			 $message .="<td>".$row["fecha_2"]."</td>";
			 $message .="<td>".$row["fecha_3"]."</td>";
			 $message .="</tr>";
			//sendemail($row["date"],$row["desrc"],$row["fechaini"],$row["peried"],$row["fecha_1"],$row["fecha_2"],$row["fecha_3"]);
			$i++;
		}
		
	}
}
else 
{
    echo "Not Find Records / 0 results";
}


$message .="</table>
<br/><br/>
	kind Regards<br/>
	Mtto,<br/>
	Mantenimiento.<br/>
</body>
</html>
";
//print_r($results);

//set headers with content-type HTML when sending HTML email in PHP
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// set More headers in PHP
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";

//send Mail Script
mail($to,$subject,$message,$headers);


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Disable submit button until Ajax Completes Example
  2. Read Also:  Laravel 9 Resize Image Before Upload Example
  3. Read Also:  PHP MYSQLi datetime format insert into mysql
  4. Read Also:  jQuery Delete Multiple Rows using checkbox PHP with MySQL
  5. Read Also:  Create First WordPress Plugin Step by Step for Beginners
  6. Read Also:  Chosen Ajax Autocomplete Textbox using jQuery, PHP
  7. Read Also:  PHP Vue.js Live Search Box Using MySQL
  8. Read Also:  Increment Decrement with Laravel 6 Example
  9. Read Also:  left outer join vs left join
  10. Read Also:  PHP Vue.js Live Search Box Using MySQL