gpt4 book ai didi

php - 是否可以在不使用 MIME 的情况下使用包含 CSS 装饰的 PHP 发送 html 电子邮件?

转载 作者:行者123 更新时间:2023-11-28 14:44:41 25 4
gpt4 key购买 nike

我需要用用 CSS 修饰的 PHP 发送电子邮件。我的代码现在可以正常发送 html 电子邮件。但是,我似乎找不到如何装饰它。

这是我的代码:

//Message
$message = "<html>
<head>
<style type='text/css'>
#show {border:solid 1px #c4c4c4; background-color:#f0f0f0; width:400px;}
#red {color:#F02311}
#header {font-size:14px}
p {color:#090127}
</style>
<title>
Red-line
</title>
</head>
<body>
<div id='show'>
<a id='red' href='http://www.thered-line.com'>The Red-line</a>
</div>

<p>
Hi $first_name,
</p>

<p>
Your Red-line account is almost complete. To finish, go to <a href='www.thered-line.com'>The Red-line</a> and enter your eight digit confirmation code.
</p>

<p>
Your confirmation code is: <b>$code</b>
</p>

<p>
Sincerely,
</p> <br />

<p>
The Red-line Operator
</p>
</body>
</html>";

最佳答案

我没有使用过 PHP 库,但是当我使用 .Net 创建邮件时,我从未包含像 <head> 这样的元素或 <body> .我不认为 html 邮件消息被设计成完整的 Html 文档。

我建议您包括您的 <style>元素,然后像这样直接进入您的内容:

<style type='text/css'>
#show {border:solid 1px #c4c4c4; background-color:#f0f0f0; width:400px;}
#red {color:#F02311}
#header {font-size:14px}
p {color:#090127}
</style>
<div id='show'>
<a id='red' href='http://www.thered-line.com'>The Red-line</a>
</div>

<p>
Hi $first_name,
</p>

<p>
Your Red-line account is almost complete. To finish, go to <a href='www.thered-line.com'>The Red-line</a> and enter your eight digit confirmation code.
</p>

<p>
Your confirmation code is: <b>$code</b>
</p>

<p>
Sincerely,
</p> <br />

<p>
The Red-line Operator
</p>

关于php - 是否可以在不使用 MIME 的情况下使用包含 CSS 装饰的 PHP 发送 html 电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5436862/

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