You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
611 B
21 lines
611 B
import re
|
|
from django.core.mail import send_mail
|
|
from django.conf import settings
|
|
from django.template.loader import render_to_string
|
|
|
|
|
|
def normalize_phone(phone):
|
|
retval = re.sub("\D", "", phone)
|
|
if len(retval) > 10:
|
|
retval = retval[len(retval)-10:]
|
|
return retval
|
|
|
|
def send_email(profile, subject='Робот Batiskaf-kz.kz', template='mail/base.jinja', context={}):
|
|
context['user'] = profile
|
|
message = render_to_string(template, context)
|
|
send_mail(
|
|
subject,
|
|
message,
|
|
recipient_list=[profile.email, ],
|
|
from_email=settings.DEFAULT_FROM_EMAIL
|
|
) |