= Notification Customizations TracNotification customizations can often be implemented with a short plugin. Some custom examples are given on this page. == Attachments in Notification Emails This email decorator can be used to send new ticket attachments as email attachments with the notification emails. Create a [TracDev/PluginDevelopment#Singlefileplugins single file plugin] that implements [wiki:TracDev/PluginDevelopment/ExtensionPoints/trac.notification.api.IEmailDecorator IEmailDecorator]: {{{#!python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://trac.edgewall.org/log/. from email.mime.application import MIMEApplication from trac.core import Component, implements from trac.notification.api import IEmailDecorator class AttachmentEmailDecorator(Component): implements(IEmailDecorator) # IEmailDecorator methods def decorate_message(self, event, message, charset): if event.category == 'attachment added': attachment = event.attachment filename = attachment.filename with attachment.open() as fd: part = MIMEApplication(fd.read(), Name=filename) part['Content-Disposition'] = 'attachment; filename="%s"' % filename message.attach(part) }}} See also: #3054