django - send_mail not using the correct "From" value -
When the user submits the "request" form, my application sends an email with the content of the request form and in the e-mail They input the email address as "From:" For some reasons it seems that EMAIL_HOST_USER is being used instead of "From:".
views.py
def beta_request (request): If request.method == 'POST': email = request.POST.get ("email") name = Request.POST.get ("name") message = request.POST.get ("message") send_mail ('subject', 'message', str (email), ['team@email.com'])
settings.py
EMAIL_USE_TLS = true EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = 'me@email.com' EMAIL_HOST_PASSWORD = 'pass' SERVER_EMAIL = EMAIL_HOST_USER
request.html
form action = "/ beta / request /" method = "post" accept-charset = "UTF-8 "& Gt; & Lt; Input id = "name" type = "text" name = "name" & gt; & Lt; Input id = "email" type = "email" name = "email" & gt; & Lt; Input id = "message" type = "text" name = "message" & gt; & Lt; Button class = "btn" type = "submit" value = "submit" & gt; Submit & lt; / Button & gt; & Lt; / Form & gt;
How to change the user's input in the email against my EMAIL_HOST_USER: Any advice about getting the field?
Comments
Post a Comment