1
このコードでは、別のウィンドウから生成されたBase64 URI文字列としてPDFエンコードファイルを取得し、PHPセッション変数として宣言しています。電子メールを送信しますが、Base64は文字のトンとしてデコードされ、適切に添付されたものではありません。base64文字列をメール添付pdf
function MailWithAttachment($to, $subject, $message, $senderMail, $senderName, $files){
$from = $senderName." <".$senderMail.">";
$headers = "From: $from";$headers = "MIME-Version: 1.0$newline".
"Content-Type: application/pdf;".
"boundary = \"$boundary\"$newline$newline".
"--$boundary$newline".
"Content-Type: application/pdf; charset=ISO-8859-1$newline; Content-Disposition: attachment;".
"Content-Transfer-Encoding: base64$newline$newline";
echo "<script>alert('$files')</script>";
$headers .= rtrim(chunk_split($files));
$returnpath = "-f" . $senderMail;
//send email
$mail = @mail($to, $subject, $message, $headers, $returnpath);
if($mail){ return TRUE; } else { return FALSE; }
}