我做了单独的HTML文件,然后使用file_get_content我使用它,包括它在我的内容部分,但是当我收到的电子邮件显示为文本,而不是什么html代码HTML文件的ouptut应包括里面sendgrid鄂麦邮件的内容我的HTML代码
\t
\t \t
\t
\t
Dispatched Details
\t \t \t \t
\t \t \t \t
\t \t \t \t
\t \t \t \t <?php
\t \t \t \t
\t \t \t \t $date = date('d-M-Y H:i:s');
\t \t \t \t echo "Date"." ". $date;
\t \t \t \t ?>
\t \t \t \t
Order Number:<?php echo $_SESSION['id'];?>
Vendor details:
VendorName | Code |
---|
\t
Contact<?php echo $_SESSION['vnm']?><?php echo $_SESSION['vcd']?>\t
<?php echo $_SESSION['vem']?>\t
<?php echo $_SESSION['vcn']?>Other Details:
Driver name | Driver contact |
---|
\t
Vehicle Number<?php echo $_SESSION['drivname']?>\t
<?php echo $_SESSION['dcontact']?>\t
<?php echo $_SESSION['vnumber']?>require '/sendgrid-php/vendor/autoload.php';
if(require("sendgrid-php/vendor/autoload.php"))
{echo "path found";}
$from = new SendGrid\Email(null, '[email protected]');
$subject ='Order number is';
$to = new SendGrid\Email(null, '[email protected]');
$r=file_get_contents('ret.html');
$content = new SendGrid\Content("text/plain",$r);
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();
?>
2016-07-14
art