
mailparse_msg_parse_file 함수는 이메일 메시지를 파싱할 때 사용할 수 있습니다. 이 함수는 메시지의 헤더와 본문을 분리하는 데 도움이 됩니다.
이 함수를 사용하여 메시지의 헤더를 추출할 수 있습니다. 헤더를 추출하려면, mailparse_msg_parse_file 함수의 반환값인 $minfo 변수를 사용하여 메시지의 헤더를 추출할 수 있습니다.
예를 들어, 다음의 이메일 메시지를 파싱할 때, 헤더와 본문을 분리하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$message = "From: John Doe
To: Jane Doe
Subject: Test Email
Hello World!";
$minfo = mailparse_msg_parse_file($message);
// 헤더 추출
$headers = mailparse_msg_get_part($minfo, 1);
// 본문 추출
$body = mailparse_msg_get_part($minfo, 2);
print "헤더: ";
print_r($headers);
print "n";
print "본문: ";
print_r($body);
이 코드는 이메일 메시지를 파싱하고, 헤더와 본문을 분리하여 출력합니다.
2025-03-05 12:28