gpt4 book ai didi

php - Wp_mail 不适用于 css 类

转载 作者:太空宇宙 更新时间:2023-11-04 11:06:35 24 4
gpt4 key购买 nike

我使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com