Answer the question
In order to leave comments, you need to log in
How to do it (all info in the description)?
addr_to = "[email protected]"
addr_from = "[email protected]"
password = "example"
msg = MIMEMultipart()
msg['From'] = addr_from
msg['To'] = addr_to
msg['Subject'] = asa["description"]
#body ="<p>%s</p>" %(inc["key"])+" "+"<p>%s</p>" %(asa["description"])+" "+"<p>%s</p>" %(inc['name'])
#body =inc["key"]+"---"+ asa["description"]+"---"+ inc['name']
msg.attach(MIMEText(body, 'plain'))
html = """\
<html>
<head></head>
<body>
<div>
<p></p><!--- Как в эти абзацы вставить постоянно обновляющиеся переменные
inc['name'],asa["desc"],inc["key"] --->
<p></p>
<p></p>
</div>
</body>
</html>
"""
msg.attach(MIMEText(html, 'html', 'utf-8'))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(addr_from, password)
server.send_message(msg)
server.quit()
Answer the question
In order to leave comments, you need to log in
When outputting, I need to clean from html tags
strip_tags($TEXT);
Or in css to the block write
color: black !important;
(In general, you need to be more specific in describing the essence of the problem)
Read about jang templates
In general, you need to:
1. Create a template
2. Pass a context
3. Render a
PS template. variables are passed to the template viaText here. {{ var }} from context.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question