adding bcc
This commit is contained in:
@@ -53,7 +53,7 @@ from django.contrib.staticfiles import finders
|
||||
|
||||
|
||||
def textify(html):
|
||||
# Remove html tags and continuous whitespaces
|
||||
# Remove html tags and continuous whitespaces
|
||||
text_only = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||
# Strip single spaces in the beginning of each line
|
||||
return text_only.replace('\n ', '\n').strip()
|
||||
@@ -61,7 +61,7 @@ def textify(html):
|
||||
def htmlstripnobr(html):
|
||||
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||
return safe_html
|
||||
|
||||
|
||||
def htmlstrip(html):
|
||||
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||
return newlinetobr(safe_html)
|
||||
@@ -80,11 +80,18 @@ def send_template_email(from_email,to_email,subject,
|
||||
text_content = textify(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'])
|
||||
else:
|
||||
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email)
|
||||
|
||||
|
||||
msg.attach_alternative(html_content, "text/html")
|
||||
|
||||
if 'attach_file' in kwargs:
|
||||
@@ -106,8 +113,8 @@ def send_template_email(from_email,to_email,subject,
|
||||
else:
|
||||
emailbounced = False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if not emailbounced:
|
||||
res = msg.send()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user