@@ -0,0 +1,1186 @@
+from django.core.management.base import BaseCommand%0Afrom django.contrib.auth.models import User%0Afrom optparse import make_option%0Aimport datetime%0A%0Aclass Command(BaseCommand):%0A    option_list = BaseCommand.option_list + (%0A        make_option(%22-u%22, %22--username%22, dest=%22username%22, nargs=1, help=%22Specify user id or username%22),%0A    )%0A%0A    def handle(self, *args, **options):%0A        username = options.get('username')%0A        user = None%0A        if username:%0A            try:%0A                user = User.objects.get(username__icontains=username)%0A            except User.MultipleObjectsReturned:%0A                user = User.objects.get(username__iexact=username)%0A            except User.DoesNotExist:%0A                user = User.objects.get(email__iexact=username)%0A            except User.DoesNotExist:%0A                print %22 ---%3E No user found at: %25s%22 %25 username%0A            %0A        if user:%0A            user.profile.send_notification_email()%0A        else:%0A           # users = User.objects.all()%0A            for user in users:%0A                user.profile.send_notification_email()%0A                print %22 ---%3E Mail sent to %25s.%22 %25 user.id%0A            print %22 ---%3E All notification sent!%22%0A

Add a command to send mail