function F_MAIL_SEND($from_name,$from_mail,$to_mail,$subject,$body,$headers=null,$file_name=null) {
//$headers .= "Reply-To: $mail\r\n";
$headers .= "From: $from_name <$from_mail>\nContent-Type:text/html;charset=euc-kr\r";
$headers .= "X-Sender: <$from_mail>\n"; // 보낸 곳
$headers .= "X-Priority: 1\n"; // 긴급 메시지 표시
$headers .= "Return-Path: <$from_mail>\r\n";
$headers .= "\n\n"; #-> 이부분은반드시 추가
if ( $_FILES[FILE_1][name] ) {
$file_name = basename($_FILES[FILE_1][name]);
$fp = fopen($_FILES[FILE_1][tmp_name], "r");
$file_size = fread($fp,$_FILES[FILE_1][size]);
fclose($fp);
$file_type = ( $file_type ) ? $file_type : "application/octet-stream";
$boundary = "--------".uniqid("part");
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
$text = "This is a multi-part message in MIME format.\r\n\r\n";
$text .= "--$boundary\r\n";
$text .= "Content-Type: text/html; charset=euc-kr\r\n";
$text .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$text .= $body."\r\n\r\n";
$text .= "--$boundary\r\n";
$text .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
$text .= "Content-Transfer-Encoding: base64\r\n\r\n";
$text .= ereg_replace( "(.{80})", "\\1\r\n",base64_encode($file_size));
}else{
$text = $body;
}
return mail( $to_mail, $subject, $text, $headers );
}
//$headers .= "Reply-To: $mail\r\n";
$headers .= "From: $from_name <$from_mail>\nContent-Type:text/html;charset=euc-kr\r";
$headers .= "X-Sender: <$from_mail>\n"; // 보낸 곳
$headers .= "X-Priority: 1\n"; // 긴급 메시지 표시
$headers .= "Return-Path: <$from_mail>\r\n";
$headers .= "\n\n"; #-> 이부분은반드시 추가
if ( $_FILES[FILE_1][name] ) {
$file_name = basename($_FILES[FILE_1][name]);
$fp = fopen($_FILES[FILE_1][tmp_name], "r");
$file_size = fread($fp,$_FILES[FILE_1][size]);
fclose($fp);
$file_type = ( $file_type ) ? $file_type : "application/octet-stream";
$boundary = "--------".uniqid("part");
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
$text = "This is a multi-part message in MIME format.\r\n\r\n";
$text .= "--$boundary\r\n";
$text .= "Content-Type: text/html; charset=euc-kr\r\n";
$text .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$text .= $body."\r\n\r\n";
$text .= "--$boundary\r\n";
$text .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
$text .= "Content-Transfer-Encoding: base64\r\n\r\n";
$text .= ereg_replace( "(.{80})", "\\1\r\n",base64_encode($file_size));
}else{
$text = $body;
}
return mail( $to_mail, $subject, $text, $headers );
}