View Source MailParser (mail_parser v0.5.1)

NIF binding of mail_parser using Rustler.

Link to this section Summary

Functions

Parses a string containing a RFC5322 raw message and extracts all nested attachments.

Link to this section Functions

Link to this function

extract_nested_attachments(raw_message)

View Source
@spec extract_nested_attachments(String.t()) ::
  {:ok, [MailParser.Attachment.t()]} | :error

Parses a string containing a RFC5322 raw message and extracts all nested attachments.

A best-effort is made to parse the message and if no headers are found :error is returned.

example

Example

iex> MailParser.extract_nested_attachments(raw_message)
{:ok, [%MailParser.Attachment{name: "example.pdf", content_type: "application/pdf", content_bytes: "..."}]}