Python Forum

Full Version: send mail is freezing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I am trying to send an email but it is freezing and if i refresh the page everything is working except for the email part, it is not sent.

    from django.core.mail import EmailMessage
	from django.conf import settings
	from django.template.loader import render_to_string

	template = render_to_string('cart/email_template.html', {'name': request.user.profile.username})
	the_email = EmailMessage(

			'Thanks for your purchase!',
			template,
			settings.EMAIL_HOST_USER,
			[request.user.profile.email],

		)

	the_email.fail_silently = False
	the_email.content_subtype = 'html'
	the_email.send()