我想发一封电子邮件
html = get_html_mail(self.request, order)
email = EmailMultiAlternatives('Subject',
html,
'no-reply@natarelochke.ru',
# to=[order.shop.email])
to=['......@gmail.com'])
email.attach_alternative(html, "text/html")
email.send()
但有一个错误,当我尝试发送电子邮件时:
AttributeError at /success/
'HttpResponse' object has no attribute 'splitlines'
我怎么能修好它?你知道吗
def get_html_mail(req, order):
request = req
return render(request, 'send_mail/send_message.html', {'order': order})
HTML
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Форма заказа</title>
<meta charset="utf-8">
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class="padd" style="width:15px;" ></td>
</tr>
<tr>
<td class="padd" style="width:15px;" ></td>
<td></td>
<td class="padd" style="width:15px;" ></td>
这是我的信息的html。这是渲染和应发送邮件地址
只需一直将
render
设置为render_to_string
ty您正在
splitlines
上的某处使用HttpResponse
。HttpResponse
没有方法splitlines
。错误不是由添加到问题中的代码段产生的。你知道吗Source of the django's HttpResponse object
找到您试图让
HttpResponse
使用splitlines
方法的地方。从删除HttpResponse
上不存在的splitlines
开始。你知道吗相关问题 更多 >
编程相关推荐