Did you know ... Search Documentation:
Pack mail_standards -- prolog/imf.pl
PublicShow source

This modules gives DCGs for using with the Internet Message Format(IMF) specified on the RFC 5322.


Line characters 998/78 limits specified on section 2.1.1 are not supported in this DCG implementation.

Section 4 corresponding for the obsolete syntax is currently unsupported.

MIME support is not provided, instead you can use mime_pack/3 from library(http/mimepack) (HTTP-support package) for creating a MIME message and mime_parse/2 from the library(mime) (C-library package).

Common Characters

For characters like WSP, CR, LF, etc. they are defined at Appendix B.1 at the RFC5234 ABNF specification.

- Gimenez, Christian
- GPLv3
A message format.
See also
- IMF Section 2
Same as message//1 but returning Strings instead of codes.
All the headers fields.
LstHeaders- A list of field/2 terms, like field(FieldName, FieldBody).
Same as header//1 but returning Strings instead of codes.
 header_field(?FieldName, ?FieldBody)//
See also
- IMF Section 2.2
See also
- IMF Section 3
- IMF Section 4
The body of the IMF. No MIME processing!
See also
- IMF Section 2.3
A folded string is a string wich can be writed into various lines. For example:
Folding text
  like this
  and this

Each CRLF is translated into space:

Folding text like this and this
See also
- IMF Section 2.2.3
- IMF Section 3.2.2
 imf_parse_file(+Path:atom, -Message:pred)
Read the file and parse it returning a Prolog predicate with all the information.

Message Output

Example of message/2:

        field("From", "from@fromhost.com"),
        field("To", "to@tohost.com"),
        field("Subject","Subject part"),
        field("Date","Wed,  9 Dec 2015 17:27:50 -0300 (ART)")]),
    body("Hi world"))
Path- The file path.
Message- A message/2 predicate with the mail header/1 and body/1 information.
Return a date predicate from a string header's value. Useful for the Date header.

The syntax is explained in section 3.3 of the IMF standard.

See also
- IMF Section 3.3