
    Bh                     T    d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d	dZd
dZy)    )Site)EmailMultiAlternatives)render_to_string)gettext_lazy)admin_reverseurljoinNc           	      L   t         j                  j                         }|xs i }|j                  dt	        |j
                  t        d            z  | d       t        ||      }t        | ||      }|rt        ||      }	|j                  |	d       |j                  |       y)z;
    Multipart message helper with template rendering.
    z
https://%sindex)	login_urltitle)subjectbodytoz	text/html)fail_silentlyN)r   objectsget_currentupdater   domainr   r   r   attach_alternativesend)
r   txt_templater   contexthtml_templater   sitetxt_bodymessager   s
             >/home/dcms/DCMS/lib/python3.12/site-packages/cms/utils/mail.py	send_mailr   	   s     <<##%DmGNN!GDKKw9O$PP 
  g6H$W8KGw7""45LL}L-    c           	      z    |rt        d      }nt        d      }t        |d| j                  g| |xs d|dd       y)z^
    Send email notification to given user.
    Used it PageUser profile creation/update.
    z$CMS - your user account was created.z$CMS - your user account was changed.z#admin/cms/mail/page_user_change.txtz********)userpasswordcreatedz$admin/cms/mail/page_user_change.htmlN)_r   email)r!   r#   r"   r   s       r   mail_page_user_changer&      sK    
 :;:;g<tzzl'M .	/r   )NNT)F )django.contrib.sites.modelsr   django.core.mailr   django.template.loaderr   django.utils.translationr   r$   cms.utils.urlutilsr   r   r   r&    r   r   <module>r.      s    , 3 3 6 5.,/r   