Browse Source

sending mail works

main
www-data 7 years ago
parent
commit
55dea2e0ed
  1. 16
      honeypot/__init__.py

16
honeypot/__init__.py

@ -98,8 +98,10 @@ def the_view(context, request): @@ -98,8 +98,10 @@ def the_view(context, request):
name, email = context.get_moin_user()
body = [
'Someone Wanted Some Sweet Honey',
'-------------------------------',
'The Honey Pot Was Accessed',
'--------------------------',
'',
'This might be an attempt to scrape the whole wiki',
'',
'wiki user: %s (%s)' % (name, email),
'',
@ -114,15 +116,17 @@ def the_view(context, request): @@ -114,15 +116,17 @@ def the_view(context, request):
headers = [' %s: %s' % (k, v) for k, v in request.headers.items()]
body.extend(headers)
body = '\n'.join(body)
message = Message(
subject='[wikis]: HoneyPot Link Was Accessed',
sender=event.request.registry.settings['mail.default_sender'],
subject='[cpi wikis]: HoneyPot Link Was Accessed',
sender=request.registry.settings['mail.default_sender'],
recipients=context.admin_emails,
body=body
)
request.mailer.send(message)
request.mailer.send_immediately(message)
return Response(body='\n'.join(body), content_type='text/plain')
return Response(body=body, content_type='text/plain')
def main(global_config, **settings):

Loading…
Cancel
Save