[][src]Function feembox::assemble_mail

pub fn assemble_mail<'a, Mc, Ai>(
    feed: &Feed,
    entry: &FeedEntry,
    message_id: String,
    alt_transforms: Ai,
    mime_override: Option<&Mime>,
    ctx: &Mc
) -> Result<Mail, IoError> where
    Mc: MailContext,
    Ai: IntoIterator<Item = &'a (Mime, Mime, String)>, 

Make a mail for the specified entry from the specified feed, running transformations and overrides

The resulting mail consists of the following:

  • entry.summary, if any, then
  • if entry.content then entry.content.body or "Link: {content.src}". Both have their original MIME types unless mime_override is set.

Then, for each element of alt_transforms:

  • for each submail that matches the from content type
  • append a new submail consisting of the output of the command with the to content type.

Then, each submail is wrapped in a multipart/alternative under the status mail consisting of:

  • Authors (entry, then contributors, then feed, unique), according to DisplayFeedPerson,
  • Publication and update dates (if present),
  • Links (entry, then feed, trailing slash removed, unique), except those matched by LINK_REL_FILTER.

The headers are:

  • MessageId: same as message_id,
  • Subject: entry title, if any, or entry ID,
  • From: same as authors, if any, or the feed title, or the feed description, or the feed ID,
  • Date: entry updated, or published time, or feed updated, or published time.