title: how to pass username in html email template in django using msg.send()
body: <p>I am new to Django coding. I am currently working on DRF Django Rest Framework along with API. I have been trying to send a HTML email template with attachment as soon as the user register . I have achieved sending the same but i want to pass the dynamic contents like email of the user registered to the HTML email template from views.py , But unable to do it. I am using msg.send().</p>
  
  <p>IN VIEWS.PY:</p>
  
  <pre><code>def attachment(request):
     queryset = User.objects.all()
     em=[]
     h=[]
     for star in queryset.iterator():
         em.append(star.email)
     print(em)    
     h=em[-1]
     msg = mail.EmailMultiAlternatives(
          subject = 'attachment',
          body = 'Hi, Welcome!',
          from_email = 'anushstella97@gmail.com',
          to = [h],
          connection = con
          )
     msg.attach_file('C:/Users/hp/Downloads/APIV1-master/APIV1- 
       master/polls/img.jpg')
     msg_html = render_to_string('C:/Users/hp/Anaconda3/Lib/site- 
    packages/allauth/templates/account/email/email_confirmation_message.html' 
    , {"email": request.user.email})
  
     msg.send()
     return HttpResponse('&lt;h1&gt;Created&lt;/h1&gt;')
  </code></pre>
  
  <p>IN HTML TEMPLATE:</p>
  
  <pre><code>&lt;p&gt;Thanks for signing up! We're excited to have you as an early user.&lt;/p&gt;
                  &lt;p&gt; Your registered email is : &lt;/p&gt;
                  &lt;p&gt;
                      &lt;strong&gt; {{ email }} &lt;/strong&gt;&lt;/p&gt;
  </code></pre>