+def create_connection():
+ connection = SMTP(str(settings.EMAIL_HOST), str(settings.EMAIL_PORT),
+ local_hostname=DNS_NAME.get_fqdn())
+
+ if bool(settings.EMAIL_USE_TLS):
+ connection.ehlo()
+ connection.starttls()
+ connection.ehlo()
+
+ if settings.EMAIL_HOST_USER and settings.EMAIL_HOST_PASSWORD:
+ connection.login(str(settings.EMAIL_HOST_USER), str(settings.EMAIL_HOST_PASSWORD))
+
+ return connection
+
+
+def create_and_send_mail_messages(messages, sender_data=None, reply_to=None):