Gmail not rendering email with html breaks properly when sent from Django -


i'm using django send email user has forgotten password. other email clients render email breaks. gmail doesn't seem care html , squishes text together.

here's email looks when rendered in hotmail:

hello bob,

you receiving email because have (or pretending has) requested new password sent account. if did not request email can let know @ support@mailapp.com.

to reset password, enter temporary password below login.

temporary password: sebdtzk4cc

once logged in, can change password in "edit profile" option under "account" in settings.

-the mail app team

however in gmail, looks this!:

hello bob,you receiving email because have (or pretending has) requested new password sent account. if did not request email can let know @ support@mailapp.com.to reset password, enter temporary password below login.temporary password: sebdtzk4cconce logged in, can change password in "edit profile" option under "account" in settings.-the mail app team

this confusing users have gmail account because temporary password being combined next sentence!

here code django using send emails:

def resetpassword(request):      data = json.loads(request.raw_post_data)      requestusername = data['username']      requestemail = data['email']      if user.objects.filter(username = requestusername).exists():         user_who_forgot_password = user.objects.get(username = requestusername)          if user_who_forgot_password.email == requestemail:               password = user.objects.make_random_password()              user_who_forgot_password.set_password(password)              user_who_forgot_password.save()             email = emailmessage('password reset on mail app', 'hello %s,</br></br>you receiving email because have (or pretending has) requested new password sent account. if did not request email can let know @ support@mailapp.com.</br></br>to reset password, enter temporary password below login.</br></br><b>temporary password:</b> %s</br></br>once logged in, can change password in "edit profile" option under "account" in settings.</br></br>-the mailapp team' % (user_who_forgot_password.username, password), = ['{email}'.format(email=requestemail,)])              email.content_subtype = "html"              email.send()              print 'password email sent'              return httpresponse("success")          else:              return httpresponse("no email found")      else:          return httpresponse("no username found") 

how can fix can rendered in gmail in such way displayed hotmail?

</br> invalid html.

you should write <br> (with not closing tag), or xml-style <br /> (a self-closing tag)


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -