Commits

Anonymous committed d4be13a

Added reply_to and bumped version

Comments (0)

Files changed (2)

contactforms/callbacks.py

 from django.template import Template, Context
-from django.core.mail import send_mail, BadHeaderError
+from django.core.mail import EmailMessage, BadHeaderError
 
 def email_callback(**kwargs):
 	"""
 			message = tmpls['body'].render(c)
 			mail_to = tmpls['to'].render(c)
 			mail_from = tmpls['from'].render(c)
-			send_mail(subject, message, mail_from, [mail_to,], fail_silently=False)
+			headers = {}
+			if 'reply_to' in tmpls:
+				headers['Reply-To'] = tmpls['reply_to'].render(c)
+			email = EmailMessage(subject, message, mail_from, [mail_to,], headers=headers)
+			email.send(fail_silently=False)
 		except BadHeaderError:
 			#TODO: logging
 			pass
 
 setup(
 	name = 'django-contact-forms',
-	version = '0.1',
+	version = '0.1.1',
 	#packages = ['contactforms',],
 	packages = find_packages(),
 	include_package_data = True,