|
|
@ -9,12 +9,13 @@ from django.core.mail import send_mail |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EmailMsgSender(object): |
|
|
|
class EmailMsgSender(object): |
|
|
|
def __init__(self, email_host, email_port, use_tls, subject, username, password, form, template_code): |
|
|
|
def __init__(self, email_host, email_port, use_tls, use_ssl, subject, username, password, form, template_code): |
|
|
|
self.email_host = email_host |
|
|
|
self.email_host = email_host |
|
|
|
self.email_port = email_port |
|
|
|
self.email_port = email_port |
|
|
|
self.username = username |
|
|
|
self.username = username |
|
|
|
self.password = password |
|
|
|
self.password = password |
|
|
|
self.use_tls = use_tls |
|
|
|
self.use_tls = use_tls |
|
|
|
|
|
|
|
self.use_ssl = use_ssl |
|
|
|
self.form = form |
|
|
|
self.form = form |
|
|
|
self.subject = subject |
|
|
|
self.subject = subject |
|
|
|
self.template_code = template_code |
|
|
|
self.template_code = template_code |
|
|
@ -28,6 +29,7 @@ class EmailMsgSender(object): |
|
|
|
settings.EMAIL_HOST_PASSWORD = self.password |
|
|
|
settings.EMAIL_HOST_PASSWORD = self.password |
|
|
|
settings.EMAIL_FROM = self.form |
|
|
|
settings.EMAIL_FROM = self.form |
|
|
|
settings.EMAIL_USE_TLS = self.use_tls |
|
|
|
settings.EMAIL_USE_TLS = self.use_tls |
|
|
|
|
|
|
|
settings.EMAIL_USE_SSL = self.use_ssl |
|
|
|
|
|
|
|
|
|
|
|
def send_msg(self, template_code, email, code): |
|
|
|
def send_msg(self, template_code, email, code): |
|
|
|
try: |
|
|
|
try: |
|
|
|