I am newbie to django learning django from a course by doing a realestate website in which user makes inquiry of every site shown in every website. Here I want to send email in this and I did as said in the video tutorial I am following and I wrote the code as follows My settings.py is
Email config
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER='glakshmi@gmail.com'
EMAIL_HOST_PASSWORD='1@st345'
EMAIL_USE_TLS=True
In the views.py
# Send email
send_mail(
'Property Listing Inquiry',
'There has been an inquiry for ' + listing + '. Sign into the admin panel for more info',
'glakshmi@gmail.com', # This is the from email address
[realtor_email, 'glakshmi.nyros@gmail.com'], # This is to email address means we are specifiying where should the email goes
fail_silently=False
)
messages.success(request, 'Your request has been submitted, a realtor will get back to you soon')
return redirect('/listings/'+listing_id)