Coverage for src/backend/InvenTree/plugin/samples/mail/mail_sample.py: 0%
21 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
1"""Sample plugin which responds to events."""
3from django.conf import settings
5import structlog
7from plugin import InvenTreePlugin
8from plugin.mixins import MailMixin
10logger = structlog.get_logger('inventree')
13class MailPluginSample(MailMixin, InvenTreePlugin):
14 """A sample plugin which provides supports for processing mails."""
16 NAME = 'MailPlugin'
17 SLUG = 'samplemail'
18 TITLE = 'Sample Mail Plugin'
20 def process_mail_out(self, mail, *args, **kwargs):
21 """Custom mail processing."""
22 print(f"Processing outgoing mail: '{mail}'")
23 print('args:', str(args))
24 print('kwargs:', str(kwargs))
26 # Issue warning that we can test for
27 if settings.PLUGIN_TESTING:
28 logger.debug('Mail `%s` triggered in sample plugin going out', mail)
30 def process_mail_in(self, mail, *args, **kwargs):
31 """Custom mail processing."""
32 print(f"Processing incoming mail: '{mail}'")
33 print('args:', str(args))
34 print('kwargs:', str(kwargs))
36 # Issue warning that we can test for
37 if settings.PLUGIN_TESTING:
38 logger.debug('Mail `%s` triggered in sample plugin coming in', mail)