Reputation: 588
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" . "\r\n";
$headers .= "Content-type:text/html; charset=iso-8859-1"."\r\n"; "X-Mailer: php".
$headers .= 'From: Password Reset <[email protected]>' . "\r\n";
The mail sends and is received in html but not formatted.
Upvotes: 0
Views: 3778
Reputation: 219834
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.
Upvotes: 4