/usr/lib/python2.7/dist-packages/gplugs/mailexceptions.py is in gozerbot 0.99.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # plugs/mailexceptions.py
#
#
""" mail exceptions in backlog """
__copyright__ = 'this file is in the public domain'
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.generic import exceptionlist
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import smtplib
plughelp.add('mailexceptions', 'mail list of occured exceptions to \
bart@gozerbot.org')
def handle_mailexceptions(bot, ievent):
""" mailexceptions [<email>] .. mail exceptions in log """
if not len(exceptionlist):
ievent.reply("no exceptions available")
return
try:
mailto = ievent.args[0]
except IndexError:
mailto = 'bart@gozerbot.org'
try:
mailserver = mailto.split('@')[1]
except IndexError:
ievent.reply("can't determine mailserver from %s" % mailto)
return
fromaddr = 'gozerbot@localhost'
msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, mailto))
for i in exceptionlist:
msg += "+++ %s\r\n" % i
server = smtplib.SMTP(mailserver)
server.sendmail(fromaddr, mailto, msg)
ievent.reply("%s exceptions send to %s" % (len(exceptionlist), mailto))
cmnds.add('mailexceptions', handle_mailexceptions, 'OPER')
examples.add('mailexceptions' , 'mailexceptions [<email>] .. mail exceptions \
log to bart@gozerbot.org or to provided email', '1) mailexceptions 2) \
mailexception bthate@gmail.com')
tests.add('mailexceptions bthate@gmail.com', 'exceptions send to bthate@gmail.com')
|