-
Notifications
You must be signed in to change notification settings - Fork 0
/
feedback_email.py
27 lines (26 loc) · 983 Bytes
/
feedback_email.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from brz import settings
class FeedbackEmail:
def send_email(self, data):
name = data.data.get('name','')
email = data.data.get('email','')
url = 'http://brzempreendimentos.com'
emailcontent = '' \
+ ( 'Nome: %s \n' % name ) \
+ ( 'E-mail: %s \n' % email )
html_content = render_to_string('feedback_email.html', {
'name': name,
'email': email,
'url': url,
})
smtpemail = EmailMultiAlternatives(
'BRZ Empreendimentos - Obrigado por se cadastrar no nosso site',
emailcontent,
settings.EMAIL_HOST_USER,
#TODO - Uncomment to enable email sending to recipients
#form.data.get('destination'),
[email]
)
smtpemail.attach_alternative(html_content, "text/html")
smtpemail.send()