답변 2개
채택된 답변
+20 포인트
1년 전
보내는 메일 함수에 대하여 예를 참고 하셔 안내드리오니 참고 하셔서 적용해보시기 바랍니다.
소스를 적용해서 보내보시면 메인쪽에서도 손쉽게 보내실수 있을겁니다.
</p>
<p>// ------------- 사용변수 안내</p>
<p> </p>
<p>// $fname : 보내는사람</p>
<p>// $fmail : 보내는 메일주소</p>
<p>// $to : 받는 사람 메일 주소</p>
<p>// $subject : 보내는 제목</p>
<p>// $content : 보내는 내용</p>
<p> </p>
<p>// 아래 예처럼 사용하시면됩니다.</p>
<p>// 사용예 : mailer('홍길동' , 'aaaa@aaaa.com', 'bbbb@bbbb.com, '테스트제목', '테스트내용');</p>
<p> </p>
<p>function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
{</p>
<p> $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";</p>
<p> // UTF-8 관련 수정</p>
<p> if ($file != "") {
$boundary = uniqid("<a href="http://sir.co.kr/");" target="_blank" rel="noopener noreferrer">http://sir.co.kr/");</a></p>
<p> $header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n";
$header .= "--$boundary\n";
}</p>
<p> if ($type) {
$content = nl2br($content);
} else {
$content = stripslashes($content);
}
$header .= "Content-Transfer-Encoding: BASE64\n\n";
$header .= chunk_split(base64_encode($content)) . "\n";</p>
<p> 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";</p>
<p> $header .= "\n";
$header .= chunk_split(base64_encode($f[data]));
$header .= "\n";
}
$header .= "--$boundary--\n";
}
@mail($to, $subject, "", $header);
}</p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인

