HEM*_*ARY 4 python django bootstrap-4
在我的views.py中我有以下代码
def cpio(request):
mainDict9=['hemant','jay','yash','Hari']
args={'mainDict9':mainDict9,}
msg_html =render_to_string('/home/user/infracom2/JournalContent/templates/JournalContent/test1.html',
{'mainDict9':mainDict9,})
from_email = 'gorantl.chowdary@ak-enterprise.com'
to_email = ['gorantla.chowdary@ak-enterprise.com']
subject="TESTING MAIL"
send_mail('email title',subject,from_email,to_email,html_message=msg_html,)
return render(request,'JournalContent/test1.html',args)
Run Code Online (Sandbox Code Playgroud)
在我的 test1.html 中我有以下代码
<!DOCTYPE html>
<html>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col" class="table-secondary"><center>Modified Binaries/components</center></th>
<th scope="col" class="table-secondary"><center>CRs</center></th>
</tr>
</thead>
<tbody>
{% for king in mainDict9 %}
<tr>
<td style="width: 10px;" class="table-active">{{ king }}</td>
<td style="width: 10px;" class="table-active"></td>
</tr>
{% endfor %}
</tbody>
</table>
</html>
Run Code Online (Sandbox Code Playgroud)
问题出在我的 GUI 中,引导代码工作正常,但是当我发送邮件中的内容时,引导函数不适用
小智 5
您应该将 css 代码放入模板中。因为大多数电子邮件客户端都会阻止额外的链接以避免恶意代码的执行。
例如:
<style>
body {background-color: powderblue;}
h1 {color: red;}
p {color: blue;}
</style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1036 次 |
| 最近记录: |