我試圖發送電子郵件錯誤發送消息
html = get_html_mail(self.request, order)
email = EmailMultiAlternatives('Subject',
html,
'[email protected]',
# to=[order.shop.email])
to=['[email protected]'])
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。它是渲染,並應發送郵件地址
你能顯示出與實際錯誤的行嗎? – nico