how to edit message part in django send_mail function in mail system and how to print from user name in message.
This is my code:
def contact(request):
if request.method == "POST":
name= request.POST['name']
email = request.POST.get('from_email')
message = request.POST['message']
send_mail(name,message,email,['contactus@gmail.com'])
return render(request, 'main/contact.html',{'name':name})
Top comments (2)
The code seems fine. I think u migjt need to double check that the method is post and also check that the contact.html is on tje main folder. And that the path is absolute, try adding the parent folder on it.
docs.djangoproject.com/en/3.1/topi...