doulu1907
doulu1907
采纳率100%
2016-08-07 14:50

如何使用BOOTSTRAP格式在PHP中发送HTML邮件

已采纳

What's the best way to construct and send an HTML email using mail()with bootstrap formatting? I've tried the following example (not full code):

$msg = "
<html>
<head>
<link href = '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
</head>
<body>
<p>This is a request to reset your password</p>
<a href='blah'>Click here to reset your password.</a>
<button type='submit' class='btn btn-info btn-sm'>Reset</button>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html; charset=iso-8859-1"."
"; "X-Mailer: php".
$headers .= 'From: Password Reset <passwordreset@blah.co.uk>' . "
";

The mail sends and is received in html but not formatted.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanniling0018 duanniling0018 5年前

    Unless you put all of the bootstrap code directly in your email, no. Email clients remove remote files by default to prevent user tracking. You cannot code around this.

    点赞 评论 复制链接分享

相关推荐