I am new in web development with django. And am testing a website for deployment but when I receive email from my contact page to my gmail account, I will see 'From me to me' instead of 'from sender to me'. Please see screenshot below: From me to me and when I open the email it looks like this when I open the email. Please someone should help me to fix this.
Here is my django code:
def contact(request):
title = 'Contact us'
form = ContactForm(request.POST or None)
confirm_message = None
if form.is_valid():
instance = form.save()
subject = instance.subject
name = instance.name
email = instance.email
comment = instance.comment
message = ' From : %s\n\
Email : %s \n\
Message: %s ' %(name, email, comment)
emailFrom = email
emailTo = settings.EMAIL_HOST_USER
send_mail(subject, message, emailFrom, recipient_list=[emailTo], fail_silently=True)
title = 'Thanks!!'
confirm_message = "Thanks for the message we will get right back to you"
form = None
context = {
'title':title,
'form': form,
'confirm_message': confirm_message,
}
return render(request, 'website/contact.html', context)