Ticket #3448: core_mail_help-v2.diff
File core_mail_help-v2.diff, 2.9 KB (added by , 18 years ago) |
---|
-
django/core/mail.py
33 33 val = Header(val, settings.DEFAULT_CHARSET) 34 34 MIMEText.__setitem__(self, name, val) 35 35 36 def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user= settings.EMAIL_HOST_USER, auth_password=settings.EMAIL_HOST_PASSWORD):36 def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None): 37 37 """ 38 38 Easy wrapper for sending a single message to a recipient list. All members 39 39 of the recipient list will see the other recipients in the 'To' field. 40 41 If auth_user is None, the EMAIL_HOST_USER setting is used. 42 If auth_password is None, the EMAIL_HOST_PASSWORD setting is used. 40 43 """ 44 if auth_user is None: 45 auth_user=settings.EMAIL_HOST_USER 46 if auth_password is None: 47 auth_password=settings.EMAIL_HOST_PASSWORD 41 48 return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently, auth_user, auth_password) 42 49 43 def send_mass_mail(datatuple, fail_silently=False, auth_user= settings.EMAIL_HOST_USER, auth_password=settings.EMAIL_HOST_PASSWORD):50 def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None): 44 51 """ 45 52 Given a datatuple of (subject, message, from_email, recipient_list), sends 46 53 each message to each recipient list. Returns the number of e-mails sent. 47 54 48 55 If from_email is None, the DEFAULT_FROM_EMAIL setting is used. 49 56 If auth_user and auth_password are set, they're used to log in. 57 If auth_user is None, the EMAIL_HOST_USER setting is used. 58 If auth_password is None, the EMAIL_HOST_PASSWORD setting is used. 50 59 """ 60 if auth_user is None: 61 auth_user=settings.EMAIL_HOST_USER 62 if auth_password is None: 63 auth_password=settings.EMAIL_HOST_PASSWORD 51 64 try: 52 65 server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) 53 66 if auth_user and auth_password: -
docs/email.txt
34 34 ``django.core.mail.send_mail()``. Here's its definition:: 35 35 36 36 send_mail(subject, message, from_email, recipient_list, 37 fail_silently=False, auth_user= EMAIL_HOST_USER,38 auth_password= EMAIL_HOST_PASSWORD)37 fail_silently=False, auth_user=None, 38 auth_password=None) 39 39 40 40 The ``subject``, ``message``, ``from_email`` and ``recipient_list`` parameters 41 41 are required. … … 65 65 Here's the definition:: 66 66 67 67 send_mass_mail(datatuple, fail_silently=False, 68 auth_user= EMAIL_HOST_USER, auth_password=EMAIL_HOST_PASSWORD):68 auth_user=None, auth_password=None): 69 69 70 70 ``datatuple`` is a tuple in which each element is in this format:: 71 71