Files
modoboa/demo/views.py
T
Antoine Nguyen b7d77254ce wip: Resellers and limits (see #105)
* Added support for migrations
* Big refactoring of the admin code

done: Support for SHA256 algorithm to store passwords (fix #195)
done: admin models refactoring (fix #196)
2012-01-27 13:51:29 +01:00

42 lines
1.4 KiB
Python
Executable File

# coding: utf-8
import os
from django.conf import settings
from django.contrib.auth.decorators import login_required
from modoboa.lib.webutils import ajax_response
from modoboa.lib.emailutils import sendmail_simple, sendmail_fromfile
from modoboa.lib.decorators import needs_mailbox
@login_required
@needs_mailbox()
def send_virus(request):
status, error = sendmail_fromfile("virus@example.net", request.user.username,
os.path.join(settings.MODOBOA_DIR,
"tmp/virus.msg"))
if status:
return ajax_response(request)
return ajax_response(request, "ko", respmsg=error)
@login_required
@needs_mailbox()
def send_spam(request):
status, error = sendmail_simple("spam@example.net", request.user.username, """
This is the GTUBE, the
Generic
Test for
Unsolicited
Bulk
Email
If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
You should send this test mail from an account outside of your network.
""")
if status:
return ajax_response(request)
return ajax_response(request, "ko", respmsg=error)