B
    ©0H[Ð  ã               @   sH   d dl Z d dlmZmZmZ d dlmZ d dlmZ G dd„ deƒZ	dS )é    N)Úmail_adminsÚmail_managersÚ	send_mail)ÚBaseCommand)Útimezonec               @   s$   e Zd ZdZdZdd„ Zdd„ ZdS )ÚCommandzASends a test email to the email addresses specified as arguments.zRYou must specify some email recipients, or pass the --managers or --admin options.c             C   s8   |j dddd� |j ddddd	� |j d
dddd	� d S )NÚemailÚ*z4One or more email addresses to send a test email to.)ÚnargsÚhelpz
--managersÚ
store_trueÚmanagerszBSend a test email to the addresses specified in settings.MANAGERS.)ÚactionÚdestr   z--adminsÚadminsz@Send a test email to the addresses specified in settings.ADMINS.)Úadd_argument)ÚselfÚparser© r   úqC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\django\core\management\commands\sendtestemail.pyÚadd_arguments   s    zCommand.add_argumentsc             O   sP   dt  ¡ t ¡ f }t|dd |d d� |d r:t|dƒ |d rLt|dƒ d S )	NzTest email from %s on %sz*If you're reading this, it was successful.r   )ÚsubjectÚmessageZ
from_emailZrecipient_listr   z)This email was sent to the site managers.r   z'This email was sent to the site admins.)ÚsocketÚgethostnamer   Únowr   r   r   )r   ÚargsÚkwargsr   r   r   r   Úhandle   s    
zCommand.handleN)Ú__name__Ú
__module__Ú__qualname__r   Zmissing_args_messager   r   r   r   r   r   r      s   r   )
r   Zdjango.core.mailr   r   r   Zdjango.core.management.baser   Zdjango.utilsr   r   r   r   r   r   Ú<module>   s   