summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordm03514 <dm03514@dm03514-Inspiron-1545>2011-11-10 23:17:24 -0500
committerdm03514 <dm03514@dm03514-Inspiron-1545>2011-11-10 23:17:24 -0500
commit17ccd5e6648a3bde1995bac58a12be5b43969f99 (patch)
tree2f89d442baf3ad6c4e227af60447d43be95ebaf8
parent82e7b785a3ca9fb189dea94c18b408cd07106ee3 (diff)
downloadaskbot-17ccd5e6648a3bde1995bac58a12be5b43969f99.tar.gz
askbot-17ccd5e6648a3bde1995bac58a12be5b43969f99.tar.bz2
askbot-17ccd5e6648a3bde1995bac58a12be5b43969f99.zip
Send Email Command Feature 131
-rw-r--r--askbot/management/commands/send_email.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/askbot/management/commands/send_email.py b/askbot/management/commands/send_email.py
new file mode 100644
index 00000000..8f67ad2f
--- /dev/null
+++ b/askbot/management/commands/send_email.py
@@ -0,0 +1,29 @@
+from askbot.utils.mail import send_mail
+from django.core.exceptions import ValidationError
+from django.core.management.base import BaseCommand, CommandError
+from django.core.validators import validate_email
+
+class Command(BaseCommand):
+ args = '<recipients email>'
+ help = 'Sends a test email to the specified email address'
+
+ def handle(self, *args, **options):
+
+ if len(args) != 1:
+ raise CommandError('Recipients email address required')
+
+ try:
+ validate_email(args[0])
+ except ValidationError:
+ raise CommandError('%s is not a valid email address' % (args[0]))
+
+ send_mail(
+ subject_line = 'Askbot Mail Test',
+ body_text = 'Askbot Mail Test',
+ recipient_list = [args[0]],
+ )
+
+
+
+
+