 |
|
|  |
|
 |
13³â Àü |
<?php
$title = "÷ºÎ¸ÞÀÏ º¸³»±â";
$mailheaders = "Return-Path: program@mytechnic.com\r\n";
$mailheaders .= "From: program@mytechnic.com\r\n";
$mailheaders .= "X-Mailer: multimail\r\n";
$boundary = "----".uniqid("part");
# ÷ºÎ ÆÄÀÏ Ã³¸®
$upfile = $_FILES['upfile'];
$upfile_name = $_FILES['upfile']['name'];
$upfile_tmpname = $_FILES['upfile']['tmp_name'];
$upfile_size = $_FILES['upfile']['size'];
$upfile_type = $_FILES['upfile']['type'];
if($upfile_tmpname && $upfile_size) {
$filename = basename($upfile_name);
$fp = fopen($upfile_tmpname, "r");
$file_contents = fread($fp, $upfile_size);
fclose($fp);
if($upfile_type == "") {
$userfile_type = "application/octet-stream";
}
// Çì´õ ÆÄÆ®¸¦ ÀÛ¼ºÇÑ´Ù.
// Multipart/mixed ÀÏ°æ¿ì ÷ºÎÆÄÀÏÀÌ ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù.
$mailheaders .= "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-Type: Multipart/mixed; boundary = \"$boundary\"";
// º»¹® ÆÄÆ®¸¦ ÀÛ¼ºÇÑ´Ù.
$bodytext = "This is a multi-part message in MIME format.\r\n\r\n";
$bodytext .= "--$boundary\r\n";
$bodytext .= "Content-Type: text/html; charset=EUC-KR\r\n";
$bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
$bodytext .= base64_encode($contents)."\r\n\r\n";
// ÆÄÀÏ÷ºÎ ÆÄÆ®¸¦ ÀÛ¼ºÇÑ´Ù.
$bodytext .= "--$boundary\r\n";
$bodytext .= "Content-Type: $upfile_type; name=\"$upfile_name\"\r\n";
$bodytext .= "Content-Transfer-Encoding: base64\r\n";
$bodytext .= "Content-Disposition: attachment; filename=\"$upfile_name\"\r\n\r\n";
$bodytext .= base64_encode($file_contents)."\r\n\r\n";
// ¸ÖƼÆÄÆ® Á¾·á¸¦ ÀÛ¼ºÇÑ´Ù.
$bodytext .= "--$boundary--";
}
else {
// Çì´õ ÆÄÆ®¸¦ ÀÛ¼ºÇÑ´Ù.
$mailheaders .= "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-Type: Multipart/alternative; boundary = \"$boundary\"";
// º»¹® ÆÄÆ®¸¦ ÀÛ¼ºÇÑ´Ù.
$bodytext .= "--$boundary\r\n";
$bodytext .= "Content-Type: text/html; charset=\"ks_c_5601-1987\"\r\n";
$bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
$bodytext .= base64_encode($contents)."\r\n\r\n";
// ¸ÖƼÆÄÆ® Á¾·á¸¦ ÀÛ¼ºÇÑ´Ù.
$bodytext .= "--$boundary--\r\n\r\n";
}
$mailresult = mail("program@mytechnic.com", $title, $bodytext, $mailheaders);
?>
|
|
̵̧ : 759 |
̵̧
¸ñ·Ï
|
|
|  |
|