Edgewall Software

Trac Notification API

TracNotification provides support for event triggered notifications.

As of 0.12 only email notification has been implemented. It is used exclusively by the ticket system. This might change in the future, if i.e. the proposal for integration of the AnnouncerPlugin infrastructure would be done.

Existing Interface

This is how it's implemented in Trac 0.12. Source: trac/notification.py

type

name

doc-string/notes

class

IEmailSender(Interface)

Extension point interface for components that allow sending e-mail.

method

send

Send message to recipients.

class

NotificationSystem(Component)

Name of the component implementing IEmailSender.
This component is used by the notification system to send emails. Trac currently provides SmtpEmailSender for connecting to an SMTP server, and SendmailEmailSender for running a sendmail-compatible executable. (since 0.12)

type

section

option name

default value

doc-string/notes

BoolOption

notification

smtp_enabled

false

Enable email notification.

Option

notification

smtp_from

'trac@localhost'

Sender address to use in notification emails.

Option

notification

smtp_from_name

''

Sender name to use in notification emails.

Option

notification

smtp_replyto

'trac@localhost'

Reply-To address to use in notification emails.

Option

notification

smtp_always_cc

''

Email address(es) to always send notifications to, addresses can be seen by all recipients (Cc:).

Option

notification

smtp_always_bcc

''

Email address(es) to always send notifications to, addresses do not appear publicly (Bcc:). (since 0.10).

Option

notification

smtp_default_domain

''

Default host/domain to append to address that do not specify one.

Option

notification

ignore_domains

''

Comma-separated list of domains that should not be considered part of email addresses (for usernames with Kerberos domains).

Option

notification

admit_domains

''

Comma-separated list of domains that should be considered as valid for email addresses (such as localdomain).

Option

notification

mime_encoding

none

Specifies the MIME encoding scheme for emails.
Valid options are 'base64' for Base64 encoding, 'qp' for Quoted-Printable, and 'none' for no encoding, in which case mails will be sent as 7bit if the content is all ASCII, or 8bit otherwise. (since 0.10)

BoolOption

notification

use_public_cc

false

Recipients can see email addresses of other CC'ed recipients.
If this option is disabled (the default), recipients are put on BCC. (since 0.10)

BoolOption

notification

use_short_addr

false

Permit email address without a host/domain (i.e. username only).
The SMTP server should accept those addresses, and either append a FQDN or use local delivery. (since 0.10)

Option

notification

smtp_subject_prefix

'__default__'

Text to prepend to subject line of notification emails.
If the setting is not defined, then the [$project_name] prefix. If no prefix is desired, then specifying an empty option will disable it. (since 0.10.1).

method

send_email

Send message to recipients via e-mail.

class

SmtpEmailSender(Component)

implements IEmailSender
E-mail sender connecting to an SMTP server.

type

section

option name

default value

doc-string/notes

Option

notification

smtp_server

'localhost'

SMTP server hostname to use for email notifications.

IntOption

notification

smtp_port

25

SMTP server port to use for email notification.

Option

notification

smtp_user

''

Username for SMTP server. (since 0.9)

Option

notification

smtp_password

''

Password for SMTP server. (since 0.9)

BoolOption

notification

use_tls

false

Use SSL/TLS to send notifications over SMTP. (since 0.10)

method

send

class

SendmailEmailSender(Component)

implements IEmailSender
E-mail sender using a locally-installed sendmail program.

type

section

option name

default value

doc-string/notes

Option

notification

sendmail_path

'sendmail'

Path to the sendmail executable.
The sendmail program must accept the -i and -f options. (since 0.12)

method

send

class

Notify(object)

Generic notification class for Trac.
Subclass this to implement different methods.

method

__init__

method

notify

method

get_recipients

Return a pair of list of subscribers to the resource 'resid'.
First list represents the direct recipients (To:), second list represents the recipients in carbon copy (Cc:).

method

begin_send

Prepare to send messages.
Called before sending begins.

method

send

Send message to recipients.

method

finish_send

Clean up after sending all messages.
Called after sending all messages.

class

NotifyEmail(Notify)

Baseclass for notification by email.

method

__init__

method

_init_pref_encoding

method

notify

method

format_header

method

add_headers

method

get_smtp_address

method

encode_header

method

send

includes methods build_addresses and remove_dup

Source: trac/notification.py

type

name

doc-string/notes

class

TicketNotificationSystem(Component)

type

section

option name

default value

doc-string/notes

BoolOption

notification

always_notify_owner

false

Always send notifications to the ticket owner (since 0.9).

BoolOption

notification

always_notify_reporter

false

Always send notifications to any address in the reporter field.

BoolOption

notification

always_notify_updater

true

Always send notifications to the person who causes the ticket property change and to any previous updater of that ticket.

Option

notification

ticket_subject_template

'$prefix #$ticket.id: $summary'

A Genshi text template snippet used to get the notification subject.
By default, the subject template is $prefix #$ticket.id: $summary. $prefix being the value of the smtp_subject_prefix option. (since 0.11)

class

TicketNotifyEmail(NotifyEmail?)

Notification of ticket changes.

method

__init__

method

notify

Send ticket change notification e-mail (untranslated)

method

_notify

method

send

method

format_props

method

parse_cc

method

diff_cc

method

format_hdr

method

format_subj

method

get_recipients

method

get_message_id

Generate a predictable, but sufficiently unique message ID.

method

send

Related information

Trac plugins using NotifyEmail (as of 25-Jul-2010)

Trac plugins using TicketNotifyEmail (as of 25-Jul-2010)

Last modified 4 years ago Last modified on Jul 25, 2010 11:17:49 PM