2017-08-03 42 views
1

我目前正在使用亚马逊为我正在构建的Web应用程序发送电子邮件。我使用的代码是: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'/>"; 
    } 
} 
} 

回答

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);