用PHP发送Bootstrap内容邮件

时间:2018-03-01 10:43:11

标签: php email bootstrap-4

如果我在$content下面打印,它会显示内容与引导程序完美无缺。

但是我在电子邮件中发送$content,收到的邮件不是自助响应。

<?php
$content = '<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="x-apple-disable-message-reformatting">  
    <title></title> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style> 
@font-face {
   font-family: museo;
   src: url('.$font_url.');
}

* {
   font-family: museo;
}
</style>
    </head>
    <body align="center">
<div class="container" style="background: white;">
  <div class="well well-sm" style="color:black;background-image: url(https://example.com/white_bg.jpg);background-position:center center;border: 2px solid #888282;margin-bottom:0px;">
      <img src="'.$image_url.'" style="padding-left:10px;width:20%;float:center;"/>
      <h1 style="font-size:350%;"><strong>Drive to Perform</strong></h1>
      <h4 align="right"><b style="padding-right:20px;font-size:120%;">'.date("d M Y").'</b></h4>
  </div>
  <div class="col-sm-6">
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
  Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
  </div>
  <div class="col-sm-6">
  It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. 
  It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
  </div>
    <div class="well well-lg" align="center" style="padding-top:  10px;padding-bottom: 10px;color:white;background: rgb(101, 99, 99);border: 2px solid #888282;margin-bottom:0px;" >All rights reserved</div>
</div>
    </body>
</html>';

echo $content;
$subject= "Drive to Perform ";  
$headers = "From: Demo <noreply@demo.com>";
$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 

// headers for attachment 
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; 
    $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n".$content."\n\n";
    $message .= "--{$mime_boundary}\n";
$emailid = 'nagaraj@inthreeaccess.com';
$mailmessage = $message;
$to = $emailid;
$ok = @mail($to, $subject, $mailmessage, $headers);
?>

在邮件中,标签的类名和ID已更改,如下所示

<div class="m_625165766303821250m_-3357783586198842014container">
<div class="m_625165766303821250m_-3357783586198842014col-sm-6">
</div>
</div>

任何人都可以告诉我如何解决这个问题。?

0 个答案:

没有答案