Ticket #5248: mail_options.diff

File mail_options.diff, 2.6 KB (added by mmcclain@…, 17 years ago)
  • django/conf/global_settings.py

     
    127127EMAIL_HOST_PASSWORD = ''
    128128EMAIL_USE_TLS = False
    129129
     130# Optional SMTP mail_options
     131EMAIL_MAIL_OPTIONS = []
     132
    130133# List of strings representing installed apps.
    131134INSTALLED_APPS = ()
    132135
  • django/core/mail.py

     
    107107    """
    108108
    109109    def __init__(self, host=None, port=None, username=None, password=None,
    110             use_tls=None, fail_silently=False):
     110            use_tls=None, fail_silently=False, mail_options=[]):
    111111        self.host = host or settings.EMAIL_HOST
    112112        self.port = port or settings.EMAIL_PORT
    113113        self.username = username or settings.EMAIL_HOST_USER
    114114        self.password = password or settings.EMAIL_HOST_PASSWORD
    115115        self.use_tls = (use_tls is not None) and use_tls or settings.EMAIL_USE_TLS
    116116        self.fail_silently = fail_silently
     117        self.mail_options = mail_options or settings.EMAIL_MAIL_OPTIONS
    117118        self.connection = None
    118119
    119120    def open(self):
     
    180181        try:
    181182            self.connection.sendmail(email_message.from_email,
    182183                    email_message.recipients(),
    183                     email_message.message().as_string())
     184                    email_message.message().as_string(),
     185                    self.mail_options)
    184186        except:
    185187            if not self.fail_silently:
    186188                raise
  • docs/email.txt

     
    3636.. _EMAIL_HOST_USER: ../settings/#email-host-user
    3737.. _EMAIL_HOST_PASSWORD: ../settings/#email-host-password
    3838.. _EMAIL_USE_TLS: ../settings/#email-use-tls
     39.. _EMAIL_MAIL_OPTIONS: ../settings/#email-mail-options
    3940
    4041send_mail()
    4142===========
  • docs/settings.txt

     
    426426
    427427See also ``EMAIL_HOST_PASSWORD``.
    428428
     429EMAIL_MAIL_OPTIONS
     430------------------
     431
     432Default: ``[]``
     433
     434The ESMTP options to use when sending mail to the SMTP server defined in
     435``EMAIL_HOST``.  The ESMTP options vary by MTA.  Example: Passing ['XVERP'] to
     436Postfix, will enable varible envelope return path (VERP) delivery of messages.
     437
    429438EMAIL_PORT
    430439----------
    431440
Back to Top