在我的项目中,我添加了时事通讯提要。但是当发送电子邮件时,它不显示图像
从django.core.mail导入EmailMultiAlternatives 从django.template.loader导入render_to_string
def send_multiple_email(名称,接收者): subject ='欢迎' sender ='host'
#passing in the context vairables
text_template = render_to_string('newsletter/email-subscribe.txt',{"name": name})
html_template = render_to_string('newsletter/new.html',{"name": name})
message = EmailMultiAlternatives(subject,text_template,sender, [receiver])
message.attach_alternative(html_template, "text/html")
message.send()