Send email : from_email ignored

75 views
Skip to first unread message

mart

unread,
Dec 14, 2010, 3:26:04 AM12/14/10
to django-users
Hi,

I'd like to send an email from django. This is the code I'm using :

# views.py
def hello(request):
send_mail('subject', "body", "ano...@email.com", ["de...@gmail.com"])
return render_to_response('hello.html', locals())

# settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "mye...@gmail.com"
EMAIL_HOST_PASSWORD = "mypassword"
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = "note...@email.com"

The email is correctly send to de...@gmail.com but there is no mention of
ano...@email.com. The email is received as coming from
mye...@gmail.com. I was expecting that it would be ano...@email.com
(or at least a mention of it).

Thank you

mart

Dan Fairs

unread,
Dec 14, 2010, 4:09:09 AM12/14/10
to django...@googlegroups.com

My guess is that your SMTP provider (gmail) will only allow the From: header to be set to the owner of the account (mye...@gmail.com) as a spam prevention measure. I don't think this is a Django issue per se.

Cheers,
Dan

--
Dan Fairs | dan....@gmail.com | www.fezconsulting.com


mart

unread,
Dec 14, 2010, 4:51:57 AM12/14/10
to django...@googlegroups.com, Dan Fairs
Yes indeed, I tried with another SMTP provider and it works
Reply all
Reply to author
Forward
0 new messages