python - RECEIVING email from Django website -
i enable people visit website able send me email yahoo mail. how can this? now, don't have mail server (yet). necessary? idea person sending email fill in email, subject , message, , posted yahoo email.
def email(request): if request.method == 'get': form = contactform() else: form = contactform(request.post) if form.is_valid(): subject = request.post.get['subject'] email = request.post.get['email'] message = request.post.get['message'] if subject , email , message: try: send_mail(subject, message, email, ['my_email@yahoo.com'], fail_silently=false,) except badheadererror: return httpresponse('invalid header found.') return redirect('thanks') else: return httpresponse('make sure have fields filled.') return render(request,"mywebsit/contact.html", {'form':form})
the form renders ok, when press send acts if has sent message, when open yahoo mail there's nothing new there.
i read necessary configure things @ settings.py
, but, far it, meant send, whereas want receive.
inspite of that, tried configuring it,
email_use_tls = true email_host = 'smtp.mail.yahoo.com' email_port = 465 email_host_user = 'email@yahoo.com' email_host_password = 'yahoopassword' default_from_email = 'email@yahoo.com' default_to_email = 'email@yahoo.com'
and error:
smtplib.smtpserverdisconnected: connection unexpectedly closed
what should do?
looks networking issue, hosting website? mail server depends on how traffic site getting, if there lot yeah it's idea if not having html code hyperlinks new window compose email yahoo account can trick too.
Comments
Post a Comment