
As of 1.0, can handle multiple headers of the same name (unlike mailparse or.GetHeader(), rather than a confusing array posing as an object. Parses messages into a Message object with handy methods like getContent(),.Supports all of RFC-5322, RFC-2822 and RFC-822, and tries to be as forgivingĪs possible for incorrectly formatted messages.No need to worryĪbout whether the content is base64 encoded and using WINDOWS-1256 charsetĮncoding (so long as mb_* or iconv* support the charset, or I’ve identified Handles content decoding and charset conversion for you.Users rely on regex patterns to decode parts of a header, and end up ignoring No need to worry about theįormat a header is in, if it’s RFC2047 or RFC2231, contains nested comments,Įmail lists, multiple lines, or combinations thereof. Handles header decoding/charset/formats for you.There are numerous advantages over other libraries: It does not use PHP’s imap* functions or the pecl mailparse There’s no need to worry about the Content-Transfer-Encoding, or how the name inĪn email address is encoded, or what charset was used.Īnd, unlike most other available email parsing libraries, MailMimeParser is its To be able to demote a document property, the column to which it is mapped must be defined with its ReadOnly attribute set to false.Use ZBateson\MailMimeParser\Message $message = Message :: parse ( $handleOrStreamOrString, true ) $subject = $message -> getHeaderValue ( 'Subject' ) $text = $message -> getTextContent () $html = $message -> getHtmlContent () $from = $message -> getHeader ( 'From' ) $fromName = $from -> getName () $fromEmail = $from -> getEmail () $to = $message -> getHeader ( 'To' ) // first email address can be accessed directly $firstToName = $to -> getName () $firstToEmail = $to -> getEmail () foreach ( $to -> getAllAddresses () as $addr ) $attachment = $message -> getAttachmentPart ( 0 ) $fname = $attachment -> getFilename () $stream = $attachment -> getContentStream () $attachment -> saveContent ( 'destination-file.ext' )


Using this information, the parser writes the column values into the applicable document property locations in the document. The location of those document properties in the document Which document properties map to the column values passed to it for demotion The parser uses the content type definition to determine the following: Once again, the parser accesses the document's content type definition. When SharePoint Foundation invokes the demotion function of the parser, it passes to the parser the document and the column values to be demoted into the document. Likewise, SharePoint Foundation can also invoke the built-in XML parser to demote properties from the content type columns, on the document library, into the document itself. SharePoint Foundation then promotes the appropriate document property to the matching column included in the content type. Using this information, the XML parser can extract each document property from the correct location in the document, and pass these properties to SharePoint Foundation. The location where the document property is stored in the document itselfįor more information about specifying this information in the content type definition, see Using Content Types to Specify XML Document Properties. The document property that maps to a given column, if one exists

The content type definition includes information about each column in that content type this information can include the following: If the document meets the requirements, SharePoint Foundation invokes the parser to promote the appropriate document properties to the document library.įor more information about the requirements for SharePoint Foundation invoking the built-in XML parser for a document, see XML Document Property Promotion and Demotion.Īfter the XML parser is invoked, it examines the document to determine the document content type, and then accesses the document's content type definition. When a user uploads an XML document, SharePoint Foundation examines the document to determine if the built-in XML parser should be invoked.
