I'm able to send the email, however, the link does not show up. There is just a blank spot where the link is supposed to be. Do I need to add it to like the username?
from django.core.mail import EmailMessage
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context
subject, from_email = 'subject', '<info@mysite.com>'
plaintext = get_template('email.txt')
htmly = get_template('email.html')
username = user.username
d = { 'username': username }
text_content = plaintext.render(d)
html_content = htmly.render(d)
msg = EmailMultiAlternatives(subject, text_content, from_email, [user.email])
msg.attach_alternative(html_content, "text/html")
msg.send()
Here is the email.html file:
<h3>Hi <strong>{{ username }}</strong>,</h6>
<p> disown kvdsvnsdov vknvisodvnsdv dsdov siod vsd. Here is a link:</p>
<a href="http://domain{% url 'home' %}">Check Now</a>
Here is the email.txt:
Hi {{ username }},
disown kvdsvnsdov vknvisodvnsdv dsdov siod vsd. Here is a link:
http://domain{% url 'home' %}