电子邮件问题中的 Phpmailer 图片

标签 php macos email phpmailer

我不知道为什么在 MAC OS X (Mail 6.2) 的邮件客户端中图像显示如下:

enter image description here

以及其他邮件客户端(例如 gmail、outlook 或 private),图像正确且如下所示:

enter image description here

PHPmailer

require_once 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer(true);
$mail->IsSMTP(); 

try {
    $mail->SMTPDebug  = 1;
    $mail->SMTPAuth   = true;
    $mail->Host       = "mail.com.mx";
    $mail->Port       = 587;
    $mail->CharSet    = "UTF-8";
    $mail->Username   = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="493a26252d202c3b0924282025672a2624672431" rel="noreferrer noopener nofollow">[email protected]</a>";
    $mail->Password   = "password?";
    $mail->SetFrom('<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7f1110520d1a0f13063f121e1613511c1012511207" rel="noreferrer noopener nofollow">[email protected]</a>', 'MA Consulting');
    $mail->Subject = 'Subject';
    $message = '<div style="border:solid 1px #427696;font-family:Arial;width:650px">
                <table style="background:#799db4;border-bottom:solid 1px #427696;width:650px; padding:5px;">
                    <tbody>
                        <tr>
                            <td>
                                <div style="padding:30px 30px 0;font-size:30px; height: 65px;">
                                    <a style="text-decoration: none; color: #FFF;" href="iq.com.mx/iq" target="_blank">MA Consulting</a> 
                                </div>
                            </td>
                            <td style="vertical-align:middle;text-align:right;padding-right:30px">
                                <img src="../media/Logo-MA.gif" width="120px" height="93px"/>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!-- more code -->';

    $mail->MsgHTML($message);
    $mail->AddAddress($email, $name);
    $mail->Send();
} catch (phpmailerException $e) {
    echo $e->errorMessage();
} catch (Exception $e) {
    echo $e->getMessage();
}

最佳答案

我只是猜测,因为很难测试,但我不认为 widthheight <img> 中的属性应包括px .

尝试删除它们:

<img src="../media/Logo-MA.gif" width="120" height="93"/>

关于电子邮件问题中的 Phpmailer 图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15072307/

相关文章:

php - 使用 Eloquent 进行 Laravel 联合查询

objective-c - Macos x 应用程序的快捷方式

objective-c - 如何在 OSX 10.9 (Mavericks) 的 NSWindow 上使用 CIFilter?

swift - SceneKit的实例属性 "autoenablesDefaultLighting"不起作用

email - 使用 Postfix 转发邮件,将 FROM 移动到 REPLY-TO 然后重写 FROM

html - 我应该为我的电子邮件模板使用 HTML 4.0 标记吗?

email - 如何避免谷歌邮件服务器要求我通过浏览器登录?

javascript - 使用 wordpress 制作 Javascript 幻灯片

php - 使用 PHP 将 Vector 提交到 MySQL 以与 2 个表建立连接

php - MS SQL CONCAT 与 "+"查询差异(使用 Doctrine 2)