cola
cola

Reputation: 12466

How can i send email with html anchor link?

I tried this:

from django.core.mail import send_mail

send_mail('hello subject', '<a href="http://127.0.0.1:8000/confirm/' + tempToken + '">Confirm</a>'
, 'from', ['to'], fail_silently=False)

But signing in email, I got a string like that:

<a href="http://127.0.0.1:8000/confirm/xxx">Confirm</a>

But i wanted a html anchor link: Confirm

How can I send the message with html anchor link?

It will be very much appreciated if someone help me to fix it.

Upvotes: -1

Views: 1727

Answers (2)

Uku Loskit
Uku Loskit

Reputation: 42040

This is because by default the send_mail() method messages in plain text rather than HTML. Check the documentation on how to send HTML.

Upvotes: 6

AdamKG
AdamKG

Reputation: 14091

Django only does plain text email by default. Check out this snippet for HTML email; there are many more here.

Upvotes: 2

Related Questions