title: Django how to get model field and send an email?
body: <p>I am newbie and just see the django documentation of sending mail . i want to send an email to the drivers after seeing their details if they are eligible i want them to send an email using thier email address that they submit while registering to my app . please tell me how do i send a email. i had already set the settings.py email host user all the needs of send an email its working on my other app . but not working on this app . how do i get the driver email and send an email from our company employee.</p>
  
  <p><strong>Views</strong></p>
  
  <pre><code>    def rentacar_carapp_sendmail(request):
          if request.POST:
              try:
                  args['driver'] = driver = Driver.objects.get(id=request.POST.get('driver_id'))
                  subject = "Please Register Your Car"
                  from_email = settings.EMAIL_HOST_USER
                  to_email = carapp.get('car_app_driver_id.driver_email')
                  join_message = """thankyou  we will contact you later """
                  send_mail(subject=subject, from_email=from_email, recipient_list=[to_email], message=join_message,
                          fail_silently=False)
  
                  driver.save()
              except:
                  pass
              return HttpResponseRedirect('/mega-admin/rentacar/driver-manager/')
  </code></pre>
  
  <p><strong>Models</strong></p>
  
  <pre><code>class Driver(models.Model):
      class Meta():
          db_table = "driver"
          verbose_name = "Driver"
          verbose_name_plural = "Drivers"
          ordering = ['driver_firstname', 'driver_lastname']
  
      driver_firstname = models.CharField(
          max_length=64,
          blank=False,
          null=False
      )
      driver_lastname = models.CharField(
          max_length=64,
          blank=False,
          null=False
      )
      driver_email = models.EmailField(
          blank=False
      )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WGAzC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGAzC.png" alt="my employe views"></a></p>