电子邮件在 Outlook 和 Hotmail 中显示为空白

发布于 2024-12-10 09:51:54 字数 3184 浏览 0 评论 0原文

由于某种原因,发送到 Hotmail 或在 Microsoft Outlook 上查看的电子邮件总是显示为空白,据我所知,对其他人来说很好(除了使用 Hotmail 和 Outlook 的人之外,没有其他人抱怨)。

我使用 CodeIgniter,这是电子邮件的设置:

$config['mailtype'] = "html";
$config['charset'] = "utf-8";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";

这就是电子邮件模板的样子:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head><title>Welcome to <?php echo $site_name; ?>!</title></head>
    <body>
        <div style="max-width: 800px; margin: 0; padding: 30px 0;">
            <table width="80%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="5%"></td>
                    <td align="left" width="95%" style="font: 13px/18px Arial, Helvetica, sans-serif;">
                        <img src="<?php echo base_url(); ?>/media/images/logo.png" alt="Logo" />
                        <br /><br />
                        <h2 style="font: normal 20px/23px Arial, Helvetica, sans-serif; margin: 0; padding: 0 0 18px; color: black;">Welcome to <?php echo $site_name; ?>!</h2>
                        Thanks for joining <?php echo $site_name; ?>. We listed your sign in details below, make sure you keep them safe.<br />
                        To verify your email address, please follow this link:<br />
                        <br />
                        <big style="font: 16px/18px Arial, Helvetica, sans-serif;"><b><a href="<?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?>" style="color: #3366cc;">Finish your registration...</a></b></big><br /><br />
                        Link doesn't work? Copy the following link to your browser address bar<br />
                        <nobr><a href="<?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?>" style="color: #3366cc;"><?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?></a></nobr><br />
                        <br />
                        Please verify your email within <?php echo $activation_period; ?> hours, otherwise your registration will become invalid and you will have to register again.<br />
                        <br />
                        <br />
                        Please note that this is an automated message, do not respond to this email. If you have any questions, please don't hesitate to <a href="<?php echo base_url(); ?>contact-us">contact us here</a>.
                        <br />
                        <br />
                        Have fun!<br />
                        The <?php echo $site_name; ?> Team
                    </td>
                </tr>
            </table>
        </div>
    </body>
</html>

我是否缺少一些东西来使其在 Outlook 和 Hotmail 中工作?谢谢!

For some reason emails sent to Hotmail or viewed on Microsoft Outlook always show up blank and as far as I know, fine on others (no one else complained except from people who use Hotmail and Outlook).

I use CodeIgniter, here is the setting for the email:

$config['mailtype'] = "html";
$config['charset'] = "utf-8";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";

And this is what the email template looks like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head><title>Welcome to <?php echo $site_name; ?>!</title></head>
    <body>
        <div style="max-width: 800px; margin: 0; padding: 30px 0;">
            <table width="80%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="5%"></td>
                    <td align="left" width="95%" style="font: 13px/18px Arial, Helvetica, sans-serif;">
                        <img src="<?php echo base_url(); ?>/media/images/logo.png" alt="Logo" />
                        <br /><br />
                        <h2 style="font: normal 20px/23px Arial, Helvetica, sans-serif; margin: 0; padding: 0 0 18px; color: black;">Welcome to <?php echo $site_name; ?>!</h2>
                        Thanks for joining <?php echo $site_name; ?>. We listed your sign in details below, make sure you keep them safe.<br />
                        To verify your email address, please follow this link:<br />
                        <br />
                        <big style="font: 16px/18px Arial, Helvetica, sans-serif;"><b><a href="<?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?>" style="color: #3366cc;">Finish your registration...</a></b></big><br /><br />
                        Link doesn't work? Copy the following link to your browser address bar<br />
                        <nobr><a href="<?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?>" style="color: #3366cc;"><?php echo site_url('/activate/'.$user_id.'/'.$new_email_key.'/'.$newsletter); ?></a></nobr><br />
                        <br />
                        Please verify your email within <?php echo $activation_period; ?> hours, otherwise your registration will become invalid and you will have to register again.<br />
                        <br />
                        <br />
                        Please note that this is an automated message, do not respond to this email. If you have any questions, please don't hesitate to <a href="<?php echo base_url(); ?>contact-us">contact us here</a>.
                        <br />
                        <br />
                        Have fun!<br />
                        The <?php echo $site_name; ?> Team
                    </td>
                </tr>
            </table>
        </div>
    </body>
</html>

Is there something I am missing to make this work in Outlook and Hotmail? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

套路撩心 2024-12-17 09:51:54

看起来由于某种原因 Hotmail/Outlook 不喜欢换行符和 crlf 电子邮件配置中的“\r\n”。删除这些解决了问题。

It looks like that for some reason Hotmail/Outlook does not like the "\r\n" on the newline and crlf email config. Removing those fixed the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文