
    xh8                     r    	 d dl Z n# e$ r	 d dlmZ  Y nw xY w	 eZn# e$ r eZY nw xY w G d de          ZdS )    Nc                   v   e Zd ZdZ	 	 	 	 	 	 ddZed             Zej        d             Zed             Zej        d             Zed	             Z	e	j        d
             Z	ed             Z
e
j        d             Z
ed             Zej        d             Zed             Zej        d             Zd Zd ZdS )Emailz'An email address with an optional name.Nr   c                     d| _         d| _        || _        |r|s|                     |           n||| _        ||| _        || _        || _        || _        dS )a  Create an Email with the given address and name.

        Either fill the separate name and email fields, or pass all information
        in the email parameter (e.g. email="dude Fella <example@example.com>").
        :param email: Email address, or name and address in standard format.
        :type email: string, optional
        :param name: Name for this sender or recipient.
        :type name: string, optional
        :param substitutions: String substitutions to be applied to the email.
        :type substitutions: list(Substitution), optional
        :param subject: Subject for this sender or recipient.
        :type subject: string, optional
        :param p: p is the Personalization object or Personalization object
                  index
        :type p: Personalization, integer, optional
        :param dynamic_template_data: Data for a dynamic transactional template.
        :type dynamic_template_data: DynamicTemplateData, optional
        N)	_name_email_personalizationparse_emailemailname_substitutions_dynamic_template_data_subject)selfr
   r   substitutionssubjectpdynamic_template_datas          N/var/www/html/what/lib/python3.11/site-packages/sendgrid/helpers/mail/email.py__init__zEmail.__init__   sy    2 
 ! 		! 		!U####  "
 	 ,&;#    c                     | j         S )zAName associated with this email.

        :rtype: string
        )r   r   s    r   r   z
Email.name>   s     zr   c                 `    |$t          |t                    st          d          || _        dS )z}Name associated with this email.

        :param value: Name associated with this email.
        :type value: string
        Nzname must be of type string.)
isinstance
basestring	TypeErrorr   r   values     r   r   z
Email.nameF   s1     E:!>!>:;;;


r   c                     | j         S )zEmail address.

        See http://tools.ietf.org/html/rfc3696#section-3 and its errata
        http://www.rfc-editor.org/errata_search.php?rfc=3696 for information
        on valid email addresses.

        :rtype: string
        r   r   s    r   r
   zEmail.emailR   s     {r   c                     || _         dS )a  Email address.

        See http://tools.ietf.org/html/rfc3696#section-3 and its errata
        http://www.rfc-editor.org/errata_search.php?rfc=3696 for information
        on valid email addresses.

        :param value: Email address.
        See http://tools.ietf.org/html/rfc3696#section-3 and its errata
        http://www.rfc-editor.org/errata_search.php?rfc=3696 for information
        on valid email addresses.
        :type value: string
        Nr    r   s     r   r
   zEmail.email^   s     r   c                     | j         S )ak  A list of Substitution objects. These substitutions will apply to
           the text and html content of the body of your email, in addition
           to the subject and reply-to parameters. The total collective size
           of your substitutions may not exceed 10,000 bytes per
           personalization object.

        :rtype: list(Substitution)
        r   r   s    r   r   zEmail.substitutionsn   s     ""r   c                     || _         dS )a  A list of Substitution objects. These substitutions will apply to
        the text and html content of the body of your email, in addition to
        the subject and reply-to parameters. The total collective size of
        your substitutions may not exceed 10,000 bytes per personalization
        object.

        :param value: A list of Substitution objects. These substitutions will
        apply to the text and html content of the body of your email, in
        addition to the subject and reply-to parameters. The total collective
        size of your substitutions may not exceed 10,000 bytes per
        personalization object.
        :type value: list(Substitution)
        Nr#   r   s     r   r   zEmail.substitutionsz   s     $r   c                     | j         S )zXData for a dynamic transactional template.

        :rtype: DynamicTemplateData
        r   r   s    r   r   zEmail.dynamic_template_data   s     **r   c                     || _         dS )zData for a dynamic transactional template.

        :param value: DynamicTemplateData
        :type value: DynamicTemplateData
        Nr&   r   s     r   r   zEmail.dynamic_template_data   s     ',###r   c                     | j         S )zFSubject for this sender or recipient.

        :rtype: string
        r   r   s    r   r   zEmail.subject   s     }r   c                     || _         dS )zSubject for this sender or recipient.

        :param value: Subject for this sender or recipient.
        :type value: string, optional
        Nr)   r   s     r   r   zEmail.subject   s     r   c                     | j         S )zmThe Personalization object or Personalization object index

        :rtype: Personalization, integer
        r   r   s    r   personalizationzEmail.personalization   s     $$r   c                     || _         dS )zThe Personalization object or Personalization object index

        :param value: The Personalization object or Personalization object
                      index
        :type value: Personalization, integer
        Nr,   r   s     r   r-   zEmail.personalization   s     !&r   c                 t    t          j        |          \  }}d|vr|}d}|sd}|sd}|| _        || _        ||fS )zAllows passing emails as "Example Name <example@example.com>"

        :param email_info: Allows passing emails as
                           "Example Name <example@example.com>"
        :type email_info: string
        @N)rfc822	parseaddrr   r
   )r   
email_infor   r
   s       r   r	   zEmail.parse_email   sa     &z22e eDE 	D 	E	
U{r   c                 N    i }| j         
| j         |d<   | j        
| j        |d<   |S )z
        Get a JSON-ready representation of this Email.

        :returns: This Email, ready for use in a request body.
        :rtype: dict
        Nr   r
   )r   r
   )r   r
   s     r   getz	Email.get   s4     9  IE&M:!!ZE'Nr   )NNNNr   N)__name__
__module____qualname____doc__r   propertyr   setterr
   r   r   r   r-   r	   r5    r   r   r   r      s       11 #'+,  ,  ,  , \   X 
[	 	 [	 	 	 X	 \  \ 	# 	# X	# $ $ $  + + X+ !, , "!,   X ^  ^ % % X% & & &  0    r   r   )	r1   ImportErroremail.utilsutilsr   	NameErrorstrobjectr   r<   r   r   <module>rC      s   !MMMM ! ! !        !JJ   JJJ
W W W W WF W W W W Ws     &&