PHP에서 메일 보낼때 내용도 안뵈고 첨부파일도 안보입니다..
보통 여기서 PHP 물어보는 일이 거의 없는데 -_-;;;
어쩜 PHP라기보단 MIME 관련 내용이기도 하고...
쿨럭... 여튼...
/usr/local/lib/php/Mail.php 를 이용해서 ...
파일을 첨부해서 메일을 돌리는걸 작성했는데요.
메일 전송은 잘 되는데...
메시지 내용도 안나오고 -_-
첨부파일도 안나오네요 -_-
MIME 문법이 틀린건지...
아래 소스랑 MIME 내용입니다.
혹시나 잘 아시는 분 조언 좀 부탁드립니다.
에효.. 빨리 만들어야 되는데 -_-;; 계속 시간끄니 원...
include "Mail.php"; // defines header $headers['Subject'] = $subject; $headers['From'] = $sender." <".$senderemail.">"; $headers['Content-Type'] = "multipart/related"; $headers['Return-Path'] = "<".$senderemail.">"; $headers['Errors-To'] = "<".$senderemail.">"; // message $message .= "------=MIME_BOUNDRY_message_parts\n"; $message .= "Content-Type: $usehtml; \n"; $message .= "Content-Transfer-Encoding: quoted-printable\n"; $message .= "\n$ment\n"; $message .= "------=MIME_BOUNDRY_message_parts--\n\n"; // Attachments if ( $_FILES['attach']['error'] === 0 ) { //Upload and Attach $tmpName = $_FILES['attach']['tmp_name']; $fileName = $_FILES['attach']['name']; $filePath = "./attach/"; $fileSize = $_FILES['attach']['size']; $AttmFile = $filePath.$fileName; move_uploaded_file( $tmpName, $AttmFile ) or die( "upload failed" ); // now we add attachments $message .= "\n\n------=MIME_BOUNDRY_main_message\n"; $message .= "Content-Type: ".$_FILES['attach']['type']."; name=\"".$fileName."\";\n"; $message .= "Content-Disposition: attachment; filename=\"".$fileName."\";\n\n"; $message .= "Content-Transfer-Encoding: base64;\n"; $message .= "\n"; //file goes here $fd=fopen ($AttmFile, "r"); $FileContent=fread($fd,filesize($AttmFile)); fclose ($fd); $FileContent=chunk_split(base64_encode($FileContent)); $message.=$FileContent; $message .= "\n------=MIME_BOUNDRY_main_message\n"; } // SMTP Connection $params['host'] = $smtphost; $params['auth'] = true; $params["username"] = $smtpuser; $params["password"] = $smtppwd; $mailer = &Mail::factory('smtp', $params); $email = "shyxu@xuice.info"; # use my email address for test. // send and check status $status =$mailer->send($email, $headers, $message); if (PEAR::isError($status)) { echo "fail"; $fail++; } else { echo "success"; $success++; }
Return-Path: <shyxu@xuice.info>
Delivered-To: shyxu@xuice.info
Subject: <C0><FC><C3><BC><B8><DE><C0><CF> <C5><D7><BD><BA><B6><D1>
From: <C1><F8><C5><C2> <shyxu@xuice.info>
Content-Type: multipart/related
Errors-To: <shyxu@xuice.info>------=MIME_BOUNDRY_message_parts
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable5G4B1d0!..
<b>EW=:6Q</b>EW=:F.6s4O1q...
:83;Av6u8;@L>_!!
------=MIME_BOUNDRY_message_parts--------=MIME_BOUNDRY_main_message
Content-Type: application/octet-stream; name="README";
Content-Disposition: attachment; filename="README";Content-Transfer-Encoding: base64;
xu3B/cC6IEdMSUJDIDEuMDkgQmV0YSC59sD8IL+1ua7Gx8C7ILHiwdjAuLfOIMfPv7S9wLTPtNku
DQrC98DMwaHAuiDBtrHdu9PAzLHiILanua6/oSCwxcDHILCwtNmw7SC6uL3DuOkgtcu0z7TZLg0K
wM+53SDDpcDaIMWpseLAziBCNbfOIMbtwf3AzCC1x77uIMDWvu68rQ0Kt7nAzMD6IMfBuLDFzbfO
IMPit8LH2LytILmtwLi46SCx17Trt84gw6XAzCC1y7TPtNkuDQq/wMDaILz2waTAuiC0q7+hILbn
tMKwzSC47rCzuLggx9Egu/PFwrbzIMDawdYgurjAzMH2uLgNCrHXt7iw1CDFqyC5rsGmtMIgvvjA
u7DNILCwsO0NCsfUvPYgv+S+4CC6zrrQKMDMsMcgv7W5rsbHwMcgx9i057rOutDAuyDAzrzix9i8
rSC1obrZwMy9w7HmKSwNCsL8sO3AxyDCyrz2IMH2waSw+iDH1Lz2LCC6r7z2IElOREVYILXuwMwg
vvi9wLTPtNkuDQqx17DNtem4uCC52bfOIMDitMK02bjpIL/Puq7H2MH2sNrB9ri4DQqx17eyIL3D
sKPAzCC++LDtILbHILPKuasgwfbDxLytILj4x8+w2rG6v+QuDQqx17PJILq4vLy/5C4uLi4uLS07
DQrD4rfCx8+9xyC2qSBnbGliY3RpdC5od3AsIGdsaWJjaWR4Lmh3cCwgZ2xpYmMuaHdwuKYNCrz4
vK2067fOIMPit8LHz73DuOkgtcu0z7TZLg0Kvue46SDAzrziuKYgx8+w7SC9zcC4vcO46SAowM+5
3cD7wM4gsOa/7CkNCsOzwL2/oyDAzrzivcO/obytIMKmvPbCysC7ILjVwPogwM684sfPvcOw7Q0K
tNnAvb+hIMimvPbCysC7IMDOvOLHz73DuOkgwve3yrTrt84gs6q/zSDA1sC7sMy0z7TZLg0Ksde3
syC1tb/yILXHvMyx5iC52bb4tM+02S4NCg0KICAgICAgICAgICAgICAgICAgICBSQUdOQVJvS0Bo
aXRlbC5rb2wuY28ua3INCiAgICAgICAgICAgICAgICAgICAgwfe+vr+hvK0guvO11bTrtMIgvu62
ssDMDQo=------=MIME_BOUNDRY_main_message
댓글 달기