pop3mail v0.1.6 Pop3mail.Multipart

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=value or key*=value. Returns string. Can be empty

Get value of key_value. key_value - format must be: key=value or key=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-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

decode(encoding, text)

Return decoded text as binary.

encoding - For example: base64, quoted-printable, 7bit, 8bit, etc.

decode_base64_lines(lines)

Return decoded text as binary.

lines - base64 encoded lines.

decode_lines(encoding, lines)

Return decoded lines as binary.

encoding - For example: base64, quoted-printable, 7bit, 8bit, etc.

extract_and_set_filename(multipart_part, content_parameters, parametername)

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:

filename0=us-ascii’en’This%20is%20even%20more%20 filename1=%2A%2A%2Afun%2A%2A%2A%20 filename*2=”isn’t it!”

get_param_number(key_value)

Get parameter number of key_value. key_value - format must be: key=value or key=value or key*=value. Returns string. Can be empty.

get_value(key_value)

Get value of key_value. key_value - format must be: key=value or key=value or key*=value.

is_multipart?(multipart_part)

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

lines_continued(line1, otherlines)

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_content(multipart_part)

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.

parse_content_type(multipart_part, content_type)

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)

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 input content_type_parameters - list of parameters in the format key=value

parse_disposition(multipart_part, disposition)

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)

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 input disposition_parameters - list of parameters in the format key=value

parse_multipart(boundary_name, raw_content, path)

Parse the boundary in the multipart content.

raw_content - multipart content boundary_name - multipart boundary to search for path - path in the multipart hierarchy. For example: relative/alternative

parse_part(arg, boundary_name, path)

Parse a part of the multipart content.

{part, index} - Numbered Pop3mail.Part. Index starts at 1 for part 1 in a multipart. boundary_name - multipart boundary name path - path in the multipart hierarchy. For example: relative/alternative

parse_part_content_id(multipart_part, encoding, list)

Parse multipart Content-ID header line. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_content_type(multipart_part, encoding, list)

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 encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_decode(multipart_part, encoding, lines)

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 input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. lines - part content splitted in lines

parse_part_disposition(multipart_part, encoding, list)

Parse multipart Content-Disposition header line. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_finish(multipart_part, encoding, list)

Finish parsing multipart header lines and start decode of the part content. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_lines(multipart_part, encoding, list)

Parse multipart header lines. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_skip(multipart_part, encoding, list)

Ignore a multipart header line. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_transfer_encoding(multipart_part, , list)

Parse multipart Content-Transfer-Encoding header line. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines

parse_part_unknown_header(multipart_part, encoding, list)

Skip an unknown multipart header line. Logs a warning. Returns a Pop3mail.Part

multipart_part - Pop3mail.Part input encoding - For example: base64, quoted-printable, 7bit, 8bit, etc. list - lines