Reputation: 595
I am using tabular format in HTML email content but its not working to send email. So can anyone let me know how to send table format email using PHP?
Upvotes: 0
Views: 510
Reputation: 1502
Hello please check your wp_mail
return value.
$message = '<table>
<tr>
<td>Name</td><td>'.$name.'</td></tr>
<tr><td>Lead Person Name</td><td>'.$pname.'</td></tr>
<tr><td>Tour Date</td><td>'.$date.'</td></tr>
<tr><td>No. Of Pax</td><td>'.$person.'</td>
</tr>
</table>';
$to = '[email protected]';
$subject = 'HTML Formate mail';
$body = $message;
$headers = array('Content-Type: text/html; charset=UTF-8');
$send_status = wp_mail( $to, $subject, $body, $headers );
if($send_status)
echo 'Mail Send Successfully';
else
echo 'Something went wrong';
I hope it will helps you.
Upvotes: 1
Reputation: 188
$data = "<table><tr><td>Name</td><td>".$name."</td></tr>
<tr><td>Lead Person Name</td><td>".$pname."</td></tr>
<tr><td>Tour Date</td><td>".$date."</td></tr>
<tr><td>No. Of Pax</td><td>".$person."</td></tr>
</table>";
$subject = 'HTML Formate mail';
$body = $data;
$headers = 'Content-Type: text/html; charset=UTF-8';
wp_mail('[email protected]', $subject, $body, $headers );
Upvotes: 1