def my_send_mail(request, subject, body, sender, recv_list, reply_to=None):
"""send_mail wrapper: write to command line if it's called on localhost
"""
local = "127.0.0.1"
if request.META['HTTP_HOST'][:len(local)] == local:
print "Subject:", subject
print "From:", sender
print "To:", recv_list
if reply_to:
print "Reply-To:", reply_to
print "Body:\n", body
else:
if reply_to:
email = EmailMessage(
subject,
body,
sender,
recv_list,
[],
headers = {'Reply-To': reply_to})
email.send()
else:
send_mail(subject, body, sender, recv_list)