adding bcc
This commit is contained in:
@@ -53,7 +53,7 @@ from django.contrib.staticfiles import finders
|
|||||||
|
|
||||||
|
|
||||||
def textify(html):
|
def textify(html):
|
||||||
# Remove html tags and continuous whitespaces
|
# Remove html tags and continuous whitespaces
|
||||||
text_only = re.sub('[ \t]+', ' ', strip_tags(html))
|
text_only = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||||
# Strip single spaces in the beginning of each line
|
# Strip single spaces in the beginning of each line
|
||||||
return text_only.replace('\n ', '\n').strip()
|
return text_only.replace('\n ', '\n').strip()
|
||||||
@@ -61,7 +61,7 @@ def textify(html):
|
|||||||
def htmlstripnobr(html):
|
def htmlstripnobr(html):
|
||||||
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||||
return safe_html
|
return safe_html
|
||||||
|
|
||||||
def htmlstrip(html):
|
def htmlstrip(html):
|
||||||
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||||
return newlinetobr(safe_html)
|
return newlinetobr(safe_html)
|
||||||
@@ -80,11 +80,18 @@ def send_template_email(from_email,to_email,subject,
|
|||||||
text_content = textify(html_content)
|
text_content = textify(html_content)
|
||||||
# html_content = newlinetobr(html_content)
|
# html_content = newlinetobr(html_content)
|
||||||
|
|
||||||
if 'cc' in kwargs:
|
print(kwargs['bcc'])
|
||||||
|
|
||||||
|
if 'bcc' in kwargs and 'cc' in kwargs:
|
||||||
|
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'],
|
||||||
|
bcc=kwargs['bcc'])
|
||||||
|
elif 'bcc' in kwargs:
|
||||||
|
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,bcc=kwargs['bcc'])
|
||||||
|
elif 'cc' in kwargs:
|
||||||
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'])
|
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'])
|
||||||
else:
|
else:
|
||||||
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email)
|
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email)
|
||||||
|
|
||||||
msg.attach_alternative(html_content, "text/html")
|
msg.attach_alternative(html_content, "text/html")
|
||||||
|
|
||||||
if 'attach_file' in kwargs:
|
if 'attach_file' in kwargs:
|
||||||
@@ -106,8 +113,8 @@ def send_template_email(from_email,to_email,subject,
|
|||||||
else:
|
else:
|
||||||
emailbounced = False
|
emailbounced = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not emailbounced:
|
if not emailbounced:
|
||||||
res = msg.send()
|
res = msg.send()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -2446,8 +2446,8 @@ def handle_send_template_email(template,email,fromemail,rowername,
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = send_template_email('Rowsandall <info@rowsandall.com>',
|
res = send_template_email('Rowsandall <info@rowsandall.com>',
|
||||||
fullemail,subject,
|
['info@rowsandall.com'],subject,
|
||||||
template,d,cc=[fromemail],**kwargs)
|
template,d,cc=[fromemail],bcc=fullemail,**kwargs)
|
||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
def handle_sendemail_message(email,fromemail,rowername,message,teamname,managername,
|
def handle_sendemail_message(email,fromemail,rowername,message,teamname,managername,
|
||||||
|
|||||||
Reference in New Issue
Block a user