内联附件使用

时间:2017-08-03 10:57:07

标签: php email amazon-ses

我目前正在使用亚马逊为我正在构建的网络应用发送电子邮件。我正在使用http://www.arrow-web.co.uk/blog/2014/12/sending-raw-email-ses处的代码发送电子邮件。但是我看不到发送内联附件的方法,到目前为止我有以下内容(所有页脚图像都存储在文件夹中),图像附加到电子邮件但不显示内联。我之前没有写过原始电子邮件,但我不确定将这些图像添加为内联的最佳方法:

    $attachments = array(
    $file_to_attach

);

if ($handle = opendir("$footerImages")) {

    $footerClose = "<br><br>"; // Drop down images on to new line


while (false !== ($entry = readdir($handle))) {
    if(($entry==".")||($entry=="signature")||($entry=="..")){} //  Ignore .. and .
    else{

        array_push($attachments, "$footerImages$entry");
    // Build footer image information
        $footerClose .= "<img alt='$entry' src='cid:$entry'/>";
    }
}
}

1 个答案:

答案 0 :(得分:0)

Mybe您必须将标题Content-Type: text/html;附加到您的电子邮件中。 看看你的电子邮件标签php mail

的标准功能
$headers = 'From: '. $from_email . "\r\n" .
'Reply-To:' . $from_email . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset="utf-8"' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();

 mail($to, $subject, $message, $headers);
相关问题