在邮件正文phpmailer类中添加嵌入图像

Lap*_*ies 3 html php phpmailer

我试图在我的邮件正文中嵌入一个图像,但它最终成为一个附件

    $mailer->Subject = APP_NAME . " - " . $name . " send you and Ad : " . $row['name'];
    $mailer->IsHTML(true);
    $mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDimes.png'); 

    //footer
    $footer = "Regards<br/><br/>";
    $footer .= '<table style="width: 95%">';
    $footer .= '<tr>';
    $footer .= '<td>';
    $footer .= "<strong><span style='font-size: 15px'>NamDimes Team</span></strong><br/>
                    NamDimes<br/>
                    Contact Number: " . APP_CONTACT . "<br/>
                    Email: " . APP_EMAIL . "<br/>
                    Website: " . APP_WEBSITE . "<br/>";
    $footer .= '</td>';
    $footer .= '<td style="text-align:right">';
    $footer .= '<img src=\"cid:logoimg\" />';
    $footer .= '</td>';
    $footer .= '</tr>';
    $footer .= '</table>';

    $mailer->Body = $body . $footer;
    $mailer->AltBody="This is text only alternative body.";
    $mailer->AddAttachment('../' . $row['image_path'], $row['name'] . ".jpg");
Run Code Online (Sandbox Code Playgroud)

我已经设置了其他所有内容,包括地址,邮件发送出去,我希望嵌入到身体中的徽标图像作为附件附加,任何人都知道为什么?

JoD*_*Dev 5

不要使用$mailer->AddEmbeddedImage,而是直接添加

<img src="http://.../images/namDiams.png" /> 代替.

邮件长度应该更轻......它的工作原理.

编辑

我不知道它是否会对你有所帮助,但这里有一点错误:

$mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDimes.png');
Run Code Online (Sandbox Code Playgroud)

应该

$mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDiames.png');//the last param the second 'a' was missing...
Run Code Online (Sandbox Code Playgroud)

这里的另一个话题