2017-08-03 63 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);