我使用 wp_mail
html 内容类型来发送电子邮件。
ob_start();
?>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<p class="main">This is main content!!</p>
</html>
<?php
$message = ob_get_contents();
$message = "<p class=\"main\">this is main content</p>"
$subject = "test_email";
$headers = "From: admin <info@example.com>";
wp_mail( $user_email, $subject, $message, $headers );
style.css
在这里:
.main{
font-family: Tahoma;
font-size: 25px;
}
但此代码不呈现 HTML/CSS 类。我该如何解决? 提前致谢
最佳答案
您需要指定内联样式,因为当收到信件时没有主类。
尝试:
$message = "<p style=\"font-family: Tahoma; font-size: 25px;\">this is main content</p>";
关于php - Wp_mail 不适用于 css 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33928052/