
mailparse_stream_encode 함수는 이메일 본문을 인코딩하는 데 사용됩니다. 이 함수의 인자로 전달할 수 있는 인코딩 방식은 다음과 같습니다.
- '7bit': 7비트 인코딩
- '8bit': 8비트 인코딩
- 'binary': 바이너리 인코딩
- 'base64': Base64 인코딩
- 'quoted-printable': 인용된 인쇄 가능 인코딩
- 'UTF-8': UTF-8 인코딩
위 코드에서 $encoded, $encoded2, $encoded3 변수에 저장된 값은 UTF-8 인코딩이 적용된 데이터를 저장합니다.
이 변수에 저장된 데이터를 이메일 본문에 포함시키는 방법은 다음과 같습니다.
#hostingforum.kr
php
$fp = fopen('data.csv', 'r');
$fp2 = fopen('data2.csv', 'r');
$fp3 = fopen('data3.csv', 'r');
$encoded = mailparse_stream_encode($fp, 'UTF-8');
$encoded2 = mailparse_stream_encode($fp2, 'UTF-8');
$encoded3 = mailparse_stream_encode($fp3, 'UTF-8');
fclose($fp);
fclose($fp2);
fclose($fp3);
$message = "이메일 본문입니다.n";
$message .= $encoded . "n";
$message .= $encoded2 . "n";
$message .= $encoded3;
// 이메일 보내기
mail('받는 사람의 이메일 주소', '이메일 제목', $message);
위 코드에서 mail() 함수를 사용하여 이메일을 보냅니다. $message 변수에 저장된 이메일 본문을 mail() 함수의 세 번째 인자로 전달하여 이메일 본문을 포함시킵니다.
2025-06-26 00:09