== Extension Point : ''IEmailSender'' == ||'''Interface'''||''IEmailSender''||'''Since'''||0.12|| ||'''Module'''||''trac.notification''||'''Source'''||[source:trunk/trac/notification/api.py#L39 api.py]|| The ''IEmailSender'' will be called by the notification system to send notification emails. == Purpose == Responsibilities of the interface are to implement a mechanism to send emails. Some implementations, see below, might do this by interfacing to an external email server or application. This also includes detecting and logging any problems with this external system when sending emails. == Usage == Implementing the interface follows the standard guidelines found in [wiki:TracDev/ComponentArchitecture] and of course [wiki:TracDev/PluginDevelopment]. Only the one ''email_sender'' configured in the environment's TracIni [wiki:TracNotification#ConfigurationOptions notification section] will be used by the notification system to send notification emails. == Examples == The following example uses a hypothetical webmail API to send notification emails. {{{#!python from trac.core import implements, Component from trac.notification import IEmailSender from hypothetical.webmail.api import webmail class SampleEmailSender(Component): implements(IEmailSender) # IEmailSender methods def send(self, from_addr, recipients, message): self.log.info("Sending notification through %s webmail to %s" % (webmail.provider, recipients)) err = webmail.send(from_addr, recipients, message) if err: self.log.info("Webmail failed: %s" % err) }}} == Available Implementations == * [source:trunk/trac/notification/api.py#126 trac.notification.SmtpEmailSender][[br]] This is the email sender that will use Python's standard ''smtplib'' module and the SMTP server configured in the environment's TracIni [wiki:TracNotification#ConfigurationOptions notification section]. * [source:trunk/trac/notification/api.py#184 trac.notification.SendmailEmailSender][[br]] This is the email sender that will use a locally-installed ''sendmail'' program. The path to this program can be configured in the environment's TracIni [wiki:TracNotification#ConfigurationOptions notification section]. == Additional Information and References == * [http://www.edgewall.org/docs/trac-trunk/html/api/trac_notification.html#trac.notification.IEmailSender API Reference] * sendmail ticket: #3870 * GnuPG encryption/signing tickets: #8294, #7488