电子邮件问题中的Phpmailer图像

时间:2013-02-25 17:03:23

标签: php macos email phpmailer

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

enter image description here

和其他邮件客户端如gmail,outlook或私有图像是正确的,如下所示:

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   = "soldier@mail.com.mx";
    $mail->Password   = "password?";
    $mail->SetFrom('no-reply@mail.com.mx', '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();
}

2 个答案:

答案 0 :(得分:3)

我只是在猜测,因为它很难测试,但我不认为width中的height<img>属性应该包含px

尝试删除它们:

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

答案 1 :(得分:2)

问题在于:

width="120px" height="93px"

您在pxwidth属性上指定了height。该语法仅与CSS相关;旧样式HTML属性始终以像素为单位(或%),并且不应指定px