project/scipycon/registration/utils.py
author amit
Sat, 30 Oct 2010 03:33:09 +0530
changeset 186 8bd09b59f359
parent 174 ccd1a896dfea
permissions -rw-r--r--
Handling the password in mail problem
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
from django.core.mail import EmailMessage
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
146
e23e937ddcda Removed unwanted mail texts and made the texts scope compliant.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     3
186
8bd09b59f359 Handling the password in mail problem
amit
parents: 174
diff changeset
     4
def send_confirmation(registrant, event ,password=None):
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
    message = EmailMessage()
146
e23e937ddcda Removed unwanted mail texts and made the texts scope compliant.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     7
    message.subject = u'Registration to %s' % (event.get_full_name())
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
    message.from_email = u'admin@scipy.in'
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
    message.to = [registrant.email]
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
174
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    11
    details = {'name': registrant.get_full_name(),
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    12
               'username': registrant.username,
186
8bd09b59f359 Handling the password in mail problem
amit
parents: 174
diff changeset
    13
               'password': password,
174
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    14
               'event_name': event.get_full_name(),
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    15
               'event_scope': event.scope,
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    16
            }
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    17
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    18
    confirmation_newuser = """Dear %(name)s,
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    19
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    20
Thank you, for registering for %(event_name)s!
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    21
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    22
You may log in to the %(event_name)s website at
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    23
http://scipy.in/%(event_scope)s/login using the username -
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    24
%(username)s and the password - %(password)s.
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    25
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    26
Looking forward to meet you at %(event_name)s.
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    27
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    28
Regards,
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    29
SciPy.in Team
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    30
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    31
If you lose your password, visit: http://scipy.in/password-reset
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    32
"""
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    33
ccd1a896dfea Fixed the bug with sending the mail content post registration.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
    34
    message.body = confirmation_newuser %(details)
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
    message.send()
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38