첨부 파일이있는 이메일을 보낼 수있는 PHP 클래스/스크립트 (opensource/free)가 있습니까?첨부 파일이 포함 된 전자 메일을 보내는 기능?
나는
mail_with_attachment($to, $subject, $_FILES["file"]);
같은 것은 사용할 수 있습니까
같은 간단한 줄까?첨부 파일이있는 이메일을 보낼 수있는 PHP 클래스/스크립트 (opensource/free)가 있습니까?첨부 파일이 포함 된 전자 메일을 보내는 기능?
나는
mail_with_attachment($to, $subject, $_FILES["file"]);
같은 것은 사용할 수 있습니까
같은 간단한 줄까?이 있습니다
하나를 선택하십시오. 이 같은
뭔가 일을 얻을 수 있습니다
<?php
function multi_attach_mail($to, $files, $sendermail){
// email fields: to, from, subject, and so on
$from = "Files attach <".$sendermail.">";
$subject = date("d.M H:i")." F=".count($files);
$message = date("Y.m.d H:i:s")."\n".count($files)." attachments";
$headers = "From: $from";
// boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// multipart boundary
$message = "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
// preparing attachments
for($i=0;$i<count($files);$i++){
if(is_file($files[$i])){
$message .= "--{$mime_boundary}\n";
$fp = @fopen($files[$i],"rb");
$data = @fread($fp,filesize($files[$i]));
@fclose($fp);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: application/octet-stream; name=\"".basename($files[$i])."\"\n" .
"Content-Description: ".basename($files[$i])."\n" .
"Content-Disposition: attachment;\n" . " filename=\"".basename($files[$i])."\"; size=".filesize($files[$i]).";\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
$message .= "--{$mime_boundary}--";
$returnpath = "-f" . $sendermail;
$ok = @mail($to, $subject, $message, $headers, $returnpath);
if($ok){ return $i; } else { return 0; }
}
?>
내가 가지고에서 comments section of the mail function's page on php.net 그. 비슷한 기능의 예를 더 보려면 여기를 참조하십시오.
내가이 일을 SwiftMailer 라이브러리를 사용 : http://swiftmailer.org/ 다음
http://pear.php.net/package/Mail – j08691