0
我正在开发一个需要发送html邮件的项目。一个url需要插入html内容,如Django的html电子邮件
<p><a href="http://dealerfunnel.com/passwordchange">Password Change Link</a></p>
我的域名,dealerfunnel.com
。如果我把任何有效的网址除http://dealerfunnel.com然后电子邮件发送。就像如果我把
google.com
然后,通过电子邮件发送。但是当我把dealerfunnel.com
,电子邮件不发送,并没有得到任何错误。
请检阅我的代码:
from dealerfunnel.funnel.view.base import *
from django.template.loader import get_template
from django.core.mail import EmailMessage
import sys
class debug():
def sendmail(self,request):
message = get_template('mail/forgot.html').render(Context({"name":"Khalid Hossain"}))
try:
msg = EmailMessage('Password Change',message, to=['[email protected]'], from_email='[email protected]')
msg.content_subtype = 'html'
msg.send()
return HttpResponse(message)
except :
e = sys.exc_info()[0]
return HttpResponse(e)
为什么不使用Django的[重置密码](https://docs.djangoproject.com/en/1.8/topics/auth /default/#module-django.contrib.auth.views)表单? – Sayse
显示你的settings.py – fledgling
和你的网址,你不应该硬编码一个页面链接,你应该使用'url'模板标签 – Sayse