I want, when a user will submit the contact form then I'll get a mail from the user mail. Everything is okay here, but the issue is I get the mail from my own mail when a user submits the form. Mean, sender mail and receiver mail is the same. That's why I can't see from which mail the mail cam Where is the problem?😢. Help me to resolve the issues.
views.py:
def ContactME(request):
if request.method == "POST":
MessageSenderName = request.POST.get('name')
SenderMessage = request.POST.get('message')
SenderEmail = request.POST.get('email')
Contact.objects.create(
Name = MessageSenderName,
Email = SenderEmail,
Message = SenderMessage,
)
send_mail(
'(Portfolio)' + MessageSenderName,
SenderMessage,
SenderEmail,
['[email protected]'],
)
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
settings.py:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = '587'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = xxxxxxxxxx
EMAIL_USE_TLS = True
You cannot send emil from user email. Insted you can send all the submitted info to your mail from the same mail.