2016-06-30 10 views
-1

テーブルアタッチメントを含むメールを送信しました。メールをGmailアカウントに送信したときに、モバイルとPCの両方で適切に動作しますが、同じメールをWebメールアカウントに送信したときに、テーブルを表示してPC(リス)で添付ファイルをダウンロードできます添付ファイルを私のインビルドのモバイルアプリ(電子メール)からダウンロードすることはできません。添付ファイルは完全に表示され、ファイルサイズも一致しますが、モバイルで開くことはできません。私はすでに1つの質問の投稿された回答であるコードを正しく使用しました。以下に示すように携帯メールから電子メール(web-mail)添付ファイルを開くことができません

私のコードの形式は正しいです:

$to = "[email protected]"; 
$from = "Website <[email protected]>"; 
$subject = "Test Attachment Email"; 

$separator = md5(time()); 

// carriage return type (we use a PHP end of line constant) 
$eol = PHP_EOL; 

// attachment name 
$filename = "document.pdf"; 

//$pdfdoc is PDF generated by FPDF 
$attachment = chunk_split(base64_encode($pdfdoc)); 

// main header 
$headers = "From: ".$from.$eol; 
$headers .= "MIME-Version: 1.0".$eol; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\""; 

// no more headers after this, we start the body! // 

$body = "--".$separator.$eol; 
$body .= "Content-Transfer-Encoding: 7bit".$eol.$eol; 
$body .= "This is a MIME encoded message.".$eol; 

// message 
$body .= "--".$separator.$eol; 
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; 
$body .= "Content-Transfer-Encoding: 8bit".$eol.$eol; 
$body .= $message.$eol; 

// attachment 
$body .= "--".$separator.$eol; 
$body .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; 
$body .= "Content-Transfer-Encoding: base64".$eol; 
$body .= "Content-Disposition: attachment".$eol.$eol; 
$body .= $attachment.$eol; 
$body .= "--".$separator."--"; 

// send message 
if (mail($to, $subject, $body, $headers)) { 
    echo "mail send ... OK"; 
} else { 
    echo "mail send ... ERROR"; 
} 

答えて

0

取付部に欠落しているファイル名があるかもしれません:私はすでにその部分を持っている

Content-Disposition: attachment; filename=... 
+0

号。 –

+0

ちょうど添付ファイルの部分にsecon linneを見てください –

関連する問題