화니

gmail 에서 메일 받을 수 있게 하기

· 2005-03-03 (목) 13:41:35 · 7056 · 3
gmail 에서 내용이 안보여서 메일함수를 수정했습니다.
lib/mailer.lib.php 입니다.

// 메일 보내기 (파일 여러개 첨부 가능)
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $charset="EUC-KR", $cc="", $bcc="") {
// type : text=0, html=1, text+html=2

$fname = "=?$charset?B?" . base64_encode($fname) . "?=";
$subject = "=?$charset?B?" . base64_encode($subject) . "?=";
$charset = ($charset != "") ? "charset=$charset" : "";

$header = "Return-Path: <$fmail>\n";
$header .= "From: $fname <$fmail>\n";
$header .= "Reply-To: <$fmail>\n";
if ($cc) $header .= "Cc: $cc\n";
if ($bcc) $header .= "Bcc: $bcc\n";
$header .= "MIME-Version: 1.0\n";
$header .= "X-Mailer: Mailer\n";


if ($file != "") {
$boundary = uniqid("http://sir.co.kr/");

$header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n";
$header .= "--$boundary\n";
}

if ($type) {
$header .= "Content-Type: TEXT/HTML; $charset\n";

if ($type == 2)
$content = nl2br($content);
} else {
$header .= "Content-Type: TEXT/PLAIN; $charset\n";
$content = stripslashes($content);
}
// $header .= "Content-Transfer-Encoding: BASE64\n\n";
$header .= "Content-Transfer-Encoding: 8BIT\n\n";
// $header .= chunk_split(base64_encode($content)) . "\n";

if ($file != "") {
foreach ($file as $f) {
$header .= "\n--$boundary\n";
$header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"$f[name]\"\n";
$header .= "Content-Transfer-Encoding: BASE64\n";
$header .= "Content-Disposition: inline; filename=\"$f[name]\"\n";

$header .= "\n";
$header .= chunk_split(base64_encode($f[data]));
$header .= "\n";
}
$header .= "--$boundary--\n";
}
mail($to, $subject, $content, $header);
}
|

댓글 3개

지메일을 쓰지는 않지만
좋은 팁이네요^^
감사감사
감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
05-03-03 조회 7,057
05-03-01 조회 4,613
05-02-28 조회 4,342
05-02-24 조회 4,753
05-02-23 조회 4,227
05-02-22 조회 4,196
05-02-22 조회 4,497
05-02-22 조회 3,929
05-02-14 조회 5,731
05-02-14 조회 5,535
05-02-14 조회 3,798
05-02-13 조회 4,412
05-02-12 조회 5,321
05-02-11 조회 4,414
05-02-11 조회 5,905
05-02-11 조회 7,303
05-02-07 조회 5,239
05-02-07 조회 4,145
05-02-05 조회 4,802
05-01-29 조회 4,839