Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to send html table in email body in php

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table style="border: black; border-style: solid;">
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "
";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "
";
$headers .= 'Cc: birthdayarchive@example.com' . "
";
$headers .= 'Bcc: birthdaycheck@example.com' . "
";

// Mail it
mail($to, $subject, $message, $headers);
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php match 
Php :: php tomorrow 
Php :: use font awesome in laravel 8 
Php :: laravel eloquent get specific columns using with function 
Php :: php is_int 
Php :: Laravel eloquent restore soft delete 
Php :: laravel break 
Php :: laravel Class "PDO" not found 
Php :: ckeditor laravel 
Php :: time function in php 
Php :: concat in php 
Php :: php http authentication 
Php :: simple_form_for id 
Php :: centos 8 laravel permission denied 
Php :: Catches the last error php 
Php :: how to on debugger in wordpress 
Php :: Array and string offset access syntax with curly braces is deprecated 
Php :: how to add page link in laravel 
Php :: how to check where function defined in php 
Php :: how hide empty category woocommerce wordpress 
Php :: upload multiple images in php 
Php :: laravel activity log 
Php :: php json get value by key 
Php :: laravel logger 
Php :: php proper function comments 
Php :: laravel route match 
Php :: laravel collection get unique values 
Php :: maintenance mode laravel 
Php :: laravel log query for model 
Php :: how to make a comment in php 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =