def send_confirmation_email(request, pledge):
assert not pledge.confirmed, "{} is already confirmed"
subject = "Confirm your pledge to secure your site"
confirmation_link = request.build_absolute_uri("{}?{}".format(
reverse('pledges:confirm', kwargs={'pk': pledge.pk}),
urlencode({'nonce': pledge.confirmation_nonce})
))
message = render_to_string('pledges/emails/confirmation.txt', {
'confirmation_link': confirmation_link
})
send_mail(
subject=subject,
message=message,
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[pledge.contact_email, ]
)
评论列表
文章目录