문제

I want to read complete header of an email. I am using IMAP for this but I am unable to get body(content) part received in header. Is it possible to get this.

 Content-Type: text/html; charset="UTF-8"

<html>
<head>
도움이 되었습니까?

해결책

If you want to fetch all, you need to fetch
  • The headers imap_fetchheader.
  • Obtain the number of bodies the message has imap_fetchstructure.
  • Each mine-headers a body has imap_fetchmime.
  • Each body it has imap_fetchbody.

    Proceed like below -: $hang =imap_fetchheader($loginToInbox,$email); $hang .="\n".imap_body($loginToInbox, $email); And then directly use INSERT command to make its entry in DB.

다른 팁

UID FETCH {$MessageID} (FLAGS BODY.PEEK[]) will fetch but not mark as read. This is wisdom from a protocol implementation of mine I did in C++.

In PHP I think you need to test imap_fetchbody() and the other imap_fetch*() functions. Or use imap_fetchstructure() which fetches all parts so you can handle them as you wish.

PS: There are examples on the PHP.net function pages. Look at the bottom, user contributions mainly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top