Index: mail.py
===================================================================
--- mail.py	(revision 2546)
+++ mail.py	(working copy)
@@ -4,6 +4,14 @@
 from email.MIMEText import MIMEText
 import smtplib
 
+# try to get the authentication settings from the master settings file, fail silently
+# and disable if not found
+try:
+    from django.conf.settings import EMAIL_AUTH_USER,EMAIL_AUTH_PASSWORD
+except ImportError:
+    EMAIL_AUTH_USER = ""
+    EMAIL_AUTH_PASSWORD = ""
+
 class BadHeaderError(ValueError):
     pass
 
@@ -14,22 +22,29 @@
             raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
         MIMEText.__setitem__(self, name, val)
 
-def send_mail(subject, message, from_email, recipient_list, fail_silently=False):
+def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None):
     """
     Easy wrapper for sending a single message to a recipient list. All members
     of the recipient list will see the other recipients in the 'To' field.
     """
-    return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently)
+    return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently, auth_user, auth_password)
 
-def send_mass_mail(datatuple, fail_silently=False):
+def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None):
     """
     Given a datatuple of (subject, message, from_email, recipient_list), sends
     each message to each recipient list. Returns the number of e-mails sent.
 
     If from_email is None, the DEFAULT_FROM_EMAIL setting is used.
+    If auth_user and auth_password are set, use them to log in to an authenticating
+    SMTP server.
     """
     try:
         server = smtplib.SMTP(EMAIL_HOST)
+        if auth_user != None and auth_password != None:
+            server.login(auth_user, auth_password)
+
+        elif EMAIL_AUTH_USER:
+            server.login(EMAIL_AUTH_USER, EMAIL_AUTH_PASSWORD)
     except:
         if fail_silently:
             return
