Neal Developer
Neal Developer

Reputation: 595

HTML email is not working in table format

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

Answers (2)

dineshkashera
dineshkashera

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

Jasmeen Maradeeya
Jasmeen Maradeeya

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

Related Questions