o |¿nháã@s’dZddlmZddlmZddlmZmZmZddl m Z ddl m Z ddl mZer2dd lmZeeƒZGd d „d e ƒZGd d „d ee ƒZdS)zCement core mail module.é)Ú annotations)Úabstractmethod)ÚAnyÚDictÚ TYPE_CHECKINGé)Ú Interface)ÚHandler)Úminimal_logger)ÚAppc@s0eZdZdZGdd„dejƒZed d d „ƒZd S)Ú MailInterfacea This class defines the Mail Interface. Handlers that implement this interface must provide the methods and attributes defined below. In general, most implementations should sub-class from the provided :class:`MailHandler` base class as a starting point. c@seZdZdZdZdS)zMailInterface.MetazHandler meta-data.ÚmailN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú interface©rrúH/usr/local/bin/dhwp/env/lib/python3.10/site-packages/cement/core/mail.pyÚMetasrÚbodyÚstrÚkwargsrÚreturnÚboolcKsdS)a= Send a mail message. Keyword arguments override configuration defaults (cc, bcc, etc). Args: body (str): The message body to send Keyword Args: to (list): List of recipients (generally email addresses) from_addr (str): Address (generally email) of the sender cc (list): List of CC Recipients bcc (list): List of BCC Recipients subject (str): Message subject line Returns: bool: ``True`` if message was sent successfully, ``False`` otherwise Example: .. code-block:: python # Using all configuration defaults app.mail.send('This is my message body') # Overriding configuration defaults app.mail.send('My message body' to=['john@example.com'], from_addr='me@example.com', cc=['jane@example.com', 'rita@example.com'], subject='This is my subject', ) Nr)ÚselfrrrrrÚsend s$zMailInterface.sendN)rrrrrr)rrrrrrrrrrrrr s r cs>eZdZdZGdd„dejƒZd ‡fdd „ Zd d d „Z‡ZS)Ú MailHandlera Mail handler implementation. **Configuration** This handler supports the following configuration settings: * **to** - Default ``to`` addresses (list, or comma separated depending on the ConfigHandler in use) * **from_addr** - Default ``from_addr`` address * **cc** - Default ``cc`` addresses (list, or comma separated depending on the ConfigHandler in use) * **bcc** - Default ``bcc`` addresses (list, or comma separated depending on the ConfigHandler in use) * **subject** - Default ``subject`` * **subject_prefix** - Additional string to prepend to the ``subject`` c@s,eZdZUdZgdggdddœZded<dS) zMailHandler.Metaze Handler meta-data (can be passed as keyword arguments to the parent class). znoreply@example.comzDefault Subject LineÚ)ÚtoÚ from_addrÚccÚbccÚsubjectÚsubject_prefixzDict[str, Any]Úconfig_defaultsN)rrrrr%Ú__annotations__rrrrr\s úrÚapp_objr rÚNonecstƒ |¡| ¡dS)N)ÚsuperÚ_setupÚ_validate_config)rr'©Ú __class__rrr*ms  zMailHandler._setupcCsrdD]4}||jj |jj¡vr6|jj |jj|¡}t|ƒtur6| d¡}dd„|Dƒ}|jj  |jj||¡qdS)N)rr!r"ú,cSsg|]}| ¡‘qSr)Ústrip)Ú.0ÚxrrrÚ |sz0MailHandler._validate_config..) ÚappÚconfigÚkeysÚ_metaÚconfig_sectionÚgetÚtyperÚsplitÚset)rÚitemÚvalueÚ value_listrrrr+qs  ÿ€ôzMailHandler._validate_config)r'r rr()rr() rrrrr rr*r+Ú __classcell__rrr,rrGs rN)rÚ __future__rÚabcrÚtypingrrrÚcore.interfacerÚ core.handlerr Ú utils.miscr Úcore.foundationr rÚLOGr rrrrrÚs      7