wiki:Email2tracParse

Version 1 (modified by erflungued, 4 years ago) ( diff )

Copied from https://web.archive.org/web/20120124141918/http://subtrac.sara.nl/oss/email2trac/wiki/Email2tracParse

How an email is being parsed

An email has a header and a body. The email header fields are used to set the ticket fields and the body is used for the description and attachments. See section below how the header and body are parsed.

Subject field

Versions greater or equal then 1.1.0 can set the subject field separator. The default value is &. Versions prior to 1.1.0 used , as subject field separator. The examples below are for versions 1.1.0 and higher.

The subject field determines if we must create/update:

  1. ticket (default action)
  2. blog, Only if the FullBlogPlugin is installed. If not then a ticket will be created.
  3. discussion, Only if the DiscussionPlugin is installed. If not then a ticket will be created.

How is the 'Subject' line parsed for tickets:

  • Subject: Bas
    • will Create a ticket with Summary : Bas
  • Subject: Bas #?owner=bas&version=0.80
    • will create a ticket with Summary : Bas and owner set to bas and version set to 0.80
  • Subject: #4: Bas
    • will update ticket #4
  • Subject: #4?owner=jaap: Bas
    • will update ticket #4 and set owner to jaap
  • Subject: blog:bas
  • Subject: blog:3 bas
    • Will update a blog entry

Body

If a message's body is broken up into several pieces (by attachments in the middle of the message), the ticket's description is set to the entire body, not just the first part

For example, from an email like this:

some text
<some binary>
more text

the ticket that is created will have "some text" and "more text" in its description and <some_binary> as attachment

Links to attachments inside the ticket description

filename links are automatically placed inside the ticket description, so that message text can clearly refer to them.

For example, an email like

I opened this file in your app:
<my file>
and I got the following error dialog:
<image>

will generate a ticket like this:

I opened this file in your app:

[attachment:"my file"]

and I got the following error dialog:

[attachment:"image"]

Inline image attachments

If an attachment is of type image/* and its Content-Disposition is inline, then a Trac Image macro is placed inside the ticket description in the appropriate place, so that the resulting ticket has the image inline where it belongs in the text.

The same email as in the previous example, if the image is inline, will result in:

I opened this file in your app

[attachment:"my file"]

and I got the following error dialog:

[[Image(image)]]

Update ticket fields

If the inline_properties is set in email2trac.conf then we can update ticket fields within the body text, eg:

This is a Test1234
@owner : bas
@type: task

Will create ticket with body text:

This is a Test1234

and the owner field set to bas and type ticket field to task. Note the keywords will be stripped from the body text. This feature can be used for a new ticket and ticket updates.

The format is:

@<ticket field name> : <value>
Note: See TracWiki for help on using the wiki.