gpt4 book ai didi

php - 设置 php 电子邮件的样式以允许 Microsoft Outlook 阅读样式

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

我遇到了 Microsoft Office 不读取我创建的任何内联样式或类的问题。起初,我只是设置了内联样式,但发现 Outlook 不读取此类代码。然后我尝试了类方法,但仍然没有任何运气。我正在使用 PHPMailer 发送电子邮件。

有人在我的代码中看到任何会阻止它工作的东西吗?

我特别更改的部分是“.emailHeader”和“.Logo”。其余仍处于内联样式形成。

$mail->isHTML(true);                                  // Set email format to 

$mail->Subject = $subject;
$mail->Body = '
<head>
<style>
.logo {
width: 200px;
height: auto;
}
.emailHeader {
max-width: 600px;
height: auto;
margin: auto;
display: block;
padding: 20px 0;
}
</style>
</head>
<body>
<div id="header-background" style="background:#16597B;width:100%;max-width:100%;height:auto;">
<div class="emailHeader">
<div class="logo"><a href=""><img src="Logo.png" style="width:200px;height:auto;text-align:center"></a></div>
<div style="clear:both;"></div>
<div id="email-to" style="color:#FFF;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:bold;font-size: 2.5em;margin-top:35px;">Hi Team,</div>
<div id="email-header-description" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:1.4em;color:#d0dde4;margin-top:45px;">
You have received a new inquiry<br><br>
</div>
</div>
</div>
<div id="email-link" style="width:100%;padding:15px;height:auto;background:#EBEBEB;position:relative;">
<div id="email-link-container" style="width:600px;height:auto;margin:auto;text-align:left;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform: translate(-50%, -50%);width:600px; font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:1.1em;">
<p>Name: ' . $first_name . ' ' . $last_name . '</p>
<p>Email: ' . $client_email . '</p>
<p>Phone: ' . $client_phone . '</p>
<p>Company: ' . $company . '</p>
<p>Contact Details: ' . $details . '</p>
</div>
</div>
</div>
</body>
';

最佳答案

尝试删除最后一个</div> .当我尝试代码时,它给了我错误

关于php - 设置 php 电子邮件的样式以允许 Microsoft Outlook 阅读样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50686677/

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