View Source Pop3mail.Multipart (pop3mail v1.5.0)
Parser for: RFC 2045 Multipart content type (previously RFC 1341).
It works recursive because a multipart content can contain other multiparts. The returned sequential list of Pop3mail.Path structs is flattened. The Part.path field shows where it is in the hierarchy. This module can also be useful to parse RFC 7578 multipart/form-data (previously RFC 2388).
Summary
Functions
Return decoded text as binary.
Return decoded text as binary.
Return decoded lines as binary.
Extract (file-)name from Content-Disposition value or Content-Type value. Returns Pop3mail.Part with filled-in filename and filename_charset.
Get parameter number of key_value. key_value
- format must be: key=value or key<parameter number>=value or key*=value. Returns string. Can be empty.
Get value of key_value. key_value
- format must be: key=value or key<number>=value or key*=value.
Is this part a multipart? Looks if the media_type starts with multipart/.
A multipart header line can continue on the next line. When next line starts with a tab-character or when there is a opening double quote not closed yet.
Parse multipart content. Returns a flattened list of Pop3mail.Part's
Parse multipart Content-Type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
Parse value of content-type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
Parse multipart Content-Disposition header line. This is either inline or attachment, and it can contain a filename. Returns a Pop3mail.Part
Parse value of Content-Disposition header line. This is either inline or attachment, and it can contain a filename. Returns a Pop3mail.Part
Parse the boundary in the multipart content.
Parse a part of the multipart content.
Parse multipart Content-ID header line. Returns a Pop3mail.Part
Parse multipart Content-Location header line as defined in RFC 2557. Returns a Pop3mail.Part
Parse multipart Content-Type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
Decode lines and add them as content in the multipart part. Returns a Pop3mail.Part
Parse multipart Content-Disposition header line. Returns a Pop3mail.Part
Finish parsing multipart header lines and start decode of the part content. Returns a Pop3mail.Part
Parse multipart header lines. Returns a Pop3mail.Part
Ignore a multipart header line. Returns a Pop3mail.Part
Parse multipart Content-Transfer-Encoding header line. Returns a Pop3mail.Part
Skip an unknown multipart header line. Logs a warning. Returns a Pop3mail.Part
Functions
Return decoded text as binary.
encoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.
Return decoded text as binary.
text
- base64 encoded text.
Return decoded lines as binary.
encoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.
extract_and_set_filename(multipart_part, content_parameters, parametername)
View Source@spec extract_and_set_filename(Pop3mail.Part.t(), [String.t()], String.t()) :: Pop3mail.Part.t()
Extract (file-)name from Content-Disposition value or Content-Type value. Returns Pop3mail.Part with filled-in filename and filename_charset.
Example of Content-Disposition header line:
Content-Disposition: attachment; filename=abc.pdf
RFC 2231 example:
filename*0*=us-ascii'en'This%20is%20even%20more%20<br> filename*1*=%2A%2A%2Afun%2A%2A%2A%20<br> filename*2="isn't it!"
Get parameter number of key_value. key_value
- format must be: key=value or key<parameter number>=value or key*=value. Returns string. Can be empty.
Get value of key_value. key_value
- format must be: key=value or key<number>=value or key*=value.
@spec is_multipart?(Pop3mail.Part.t()) :: boolean()
Is this part a multipart? Looks if the media_type starts with multipart/.
It could be multipart/alternative, multipart/relative or multipart/mixed.
multipart_part
- Pop3mail.Part
A multipart header line can continue on the next line. When next line starts with a tab-character or when there is a opening double quote not closed yet.
@spec parse_content(Pop3mail.Part.t()) :: [Pop3mail.Part.t()]
Parse multipart content. Returns a flattened list of Pop3mail.Part's
This is recursively called for each multipart part, e.g. parse_content calls itself
multipart_part
- Pop3mail.Part input.
@spec parse_content_type(Pop3mail.Part.t(), String.t()) :: Pop3mail.Part.t()
Parse multipart Content-Type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part input
parse_content_type_parameters(multipart_part, content_type_parameters)
View Source@spec parse_content_type_parameters(Pop3mail.Part.t(), [String.t()]) :: Pop3mail.Part.t()
Parse value of content-type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputcontent_type_parameters
- list of parameters in the format key=value
@spec parse_disposition(Pop3mail.Part.t(), String.t()) :: Pop3mail.Part.t()
Parse multipart Content-Disposition header line. This is either inline or attachment, and it can contain a filename. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part input
parse_disposition_parameters(multipart_part, disposition_parameters)
View Source@spec parse_disposition_parameters(Pop3mail.Part.t(), [String.t()]) :: Pop3mail.Part.t()
Parse value of Content-Disposition header line. This is either inline or attachment, and it can contain a filename. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputdisposition_parameters
- list of parameters in the format key=value
@spec parse_multipart(String.t(), String.t(), String.t()) :: [Pop3mail.Part.t()]
Parse the boundary in the multipart content.
raw_content
- multipart contentboundary_name
- multipart boundary to search forpath
- path in the multipart hierarchy. For example: relative/alternative
@spec parse_part({String.t(), integer()}, String.t(), String.t()) :: [ Pop3mail.Part.t() ]
Parse a part of the multipart content.
{part, index}
- Numbered part content. Index starts at 1 for part 1 in a multipart.boundary_name
- multipart boundary namepath
- path in the multipart hierarchy. For example: relative/alternative
@spec parse_part_content_id(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart Content-ID header line. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_content_location(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart Content-Location header line as defined in RFC 2557. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_content_type(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart Content-Type header line. It can contain media_type, charset, (file-)name and boundary. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_decode(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Decode lines and add them as content in the multipart part. Returns a Pop3mail.Part
Is called after all multipart header lines are parsed.
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.lines
- part content splitted in lines
@spec parse_part_disposition(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart Content-Disposition header line. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_finish(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Finish parsing multipart header lines and start decode of the part content. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_lines(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart header lines. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_skip(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Ignore a multipart header line. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_transfer_encoding(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Parse multipart Content-Transfer-Encoding header line. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines
@spec parse_part_unknown_header(Pop3mail.Part.t(), String.t(), [String.t()]) :: Pop3mail.Part.t()
Skip an unknown multipart header line. Logs a warning. Returns a Pop3mail.Part
multipart_part
- Pop3mail.Part inputencoding
- For example: base64, quoted-printable, 7bit, 8bit, etc.list
- lines