      send_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], fail_silently)
  
  def mail_managers(subject, message, fail_silently=False):
      "Sends a message to the managers, as defined by the MANAGERS setting."
      send_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS], fail_silently)
 
</s> remove     send_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], fail_silently)
 </s> add     EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
            settings.SERVER_EMAIL, [a[1] for a in
                settings.ADMINS]).send(fail_silently=fail_silently) </s> remove     if auth_user is None:
        auth_user = settings.EMAIL_HOST_USER
    if auth_password is None:
        auth_password = settings.EMAIL_HOST_PASSWORD
    try:
        server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
        if auth_user and auth_password:
            server.login(auth_user, auth_password)
    except:
        if fail_silently:
            return
        raise
    num_sent = 0
    for subject, message, from_email, recipient_list in datatuple:
        if not recipient_list:
            continue
        from_email = from_email or settings.DEFAULT_FROM_EMAIL
        msg = SafeMIMEText(message, 'plain', settings.DEFAULT_CHARSET)
        msg['Subject'] = subject
        msg['From'] = from_email
        msg['To'] = ', '.join(recipient_list)
        msg['Date'] = formatdate()
        try:
            random_bits = str(random.getrandbits(64))
        except AttributeError: # Python 2.3 doesn't have random.getrandbits().
            random_bits = ''.join([random.choice('1234567890') for i in range(19)])
        msg['Message-ID'] = "<%d.%s@%s>" % (time.time(), random_bits, DNS_NAME)
        try:
            server.sendmail(from_email, recipient_list, msg.as_string())
            num_sent += 1
        except:
            if not fail_silently:
                raise
    try:
        server.quit()
    except:
        if fail_silently:
            return
        raise
    return num_sent
 </s> add     connection = SMTPConnection(username=auth_user, password=auth_password,
                                 fail_silently=fail_silently)
    messages = [EmailMessage(subject, message, sender, recipient) for subject, message, sender, recipient in datatuple]
    return connection.send_messages(messages) </s> remove     return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently, auth_user, auth_password)
 </s> add     connection = SMTPConnection(username=auth_user, password=auth_password,
                                 fail_silently=fail_silently)
    return EmailMessage(subject, message, from_email, recipient_list, connection=connection).send()
    EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
            settings.SERVER_EMAIL, [a[1] for a in
                settings.MANAGERS]).send(fail_silently=fail_silently)

      send_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], fail_silently)
  
  def mail_managers(subject, message, fail_silently=False):
      "Sends a message to the managers, as defined by the MANAGERS setting."
    EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
            settings.SERVER_EMAIL, [a[1] for a in
                settings.MANAGERS]).send(fail_silently=fail_silently)

keep keep keep keep replace
 Fixed #3366 -- Part 1 of the email code refactoring and feature extension. This
part refactors email sending into a more object-oriented interface in order to
make adding new features possible without making the API unusable. Thanks to
Gary Wilson for doing the design thinking and initial coding on this.

Includes documentation addition, but it probably needs a rewrite/edit, since
I'm not very happy with it at the moment.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5141 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/core/mail.py