<?
$my_name = "보내는이 이름";
$my_email = "보내는이 이메일";
$my_subject = "제목";
$your_name = "받는이 이름";
$your_email = "받는이 이메일";
$content = "내용";
if($my_name && $my_email) $from = "\"$my_name\" <$my_email>";
else $from = "$my_email";
$your_info = "\"$your_name\" <$your_email>";
$boundary = "----".uniqid("part"); //식별자
$from2 .= "Return-Path: $from\r\n";
$from2 .= "From: $from\r\n";
$from2 .= "MIME-Version: 1.0\r\n";
$from2 .= "Content-Type: Multipart/mixed; boundary = \"$boundary\"";
$my_content .= "This is a multi-part message in MIME format.\r\n\r\n";
$my_content .= "--$boundary\r\n";
$my_content .= "Content-Type: text/html; charset=\"ks_c_5601-1987\"\r\n";
$my_content .= "Content-Transfer-Encoding: base64\r\n\r\n";
$my_content .= base64_encode($content)."\r\n\r\n";
//첨부파일 - input name = upload
if($upload) {
$filename = basename($upload_name);
$fp = fopen($upload, "r");
$file = fread($fp, $upload_size);
fclose($fp);
// 파일첨부파트
$my_content .= "--$boundary\r\n";
$my_content.= "Content-Type: ".$upload_type."; name=\"".$filename."\"\r\n";
$my_content .= "Content-Transfer-Encoding: base64\r\n";
$my_content .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$my_content .= base64_encode($file)."\r\n\r\n";
}
$from = "From:$from\nContent-Type:text/html";
mail($your_info, $my_subject , $my_content , $from2);
?>
'php, mysql' 카테고리의 다른 글
date()함수에 쓰이는 옵션 (0) | 2017.04.13 |
---|---|
문자관련 자주쓰는 함수 (0) | 2017.04.13 |
strtotime - 날짜 시간 추가하기 (0) | 2017.04.13 |
time mktime (0) | 2017.04.13 |
DB출력하여 간단히 페이징하기 (0) | 2017.04.13 |