Send mail using email from user database in django

In Django how can i send email to user by importing email from user database.

from django.contrib.auth.models import User

class PostCreateView(LoginRequiredMixin, CreateView):

model = Post
form_class = AdsForm

def form_valid(self, form):
    email = # try to import email from user model database.

    subject = 'Thanks for adding your trip'
    message = f'Hi {email}, thank you for Adding your Trip .'
    email_from = ''
    recipient_list = [email]
    send_mail(subject, message, email_from, recipient_list, fail_silently=False) = self.request.user
    return super().form_valid(form)

In this form i tried to send email to the user that adding trip, the email i tried to pickup from User database. And i get this error while sending the mail.

enter image description here

Help would be appreciated as Iam beginner to Django and programming.

If you want user email(how send the request now) you should use:

after that you can use it as valid email

Back to Top