Base Email Processor¶
BaseEmailProcessor
¶
Source code in easy_email/processors/base.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
__init__(subject, email_body, recipient_list, from_email=None, fail_silently=True, **kwargs)
¶
Initializes the email processor with the given email details and optional parameters.
Args: - subject (str): The subject of the email. - email_body (str): The body content of the email (plain text). - recipient_list (list): A list of email addresses to which the email will be sent. - from_email (str, optional): The sender’s email address. If not provided, a default will be used. - fail_silently (bool, optional): A flag that determines whether to suppress exceptions if an error occurs during email sending. Default is True (suppress errors).
Keyword Arguments (kwargs):
- files (list, optional): A list of Attachment objects that will be included with the email. The list is passed via kwargs.
Attributes:
- subject (str): The email subject.
- recipient_list (list): The list of recipients for the email.
- from_email (str): The sender’s email address.
- fail_silently (bool): Whether to fail silently or raise errors when sending the email.
- message (str): The plain text body of the email.
- html_message (str): The HTML body of the email (same as message in this case).
- send_time (datetime, optional): The time at which the email should be sent. Defaults to None (send immediately).
Source code in easy_email/processors/base.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
send(send_time=None)
¶
- send_time (Optional[Union[None, datetime, int]]): Determines when to send the email.
- None: Sends the email instantly.
- datetime: Sends the email at the specified future datetime.
- int: Sends the email after the specified number of seconds (delay).
If the datetime is in the past, the function will raise an error. If an integer is provided, it will be interpreted as a delay in seconds, and the email will be sent after that duration.
Source code in easy_email/processors/base.py
53 54 55 56 57 58 59 60 61 62 63 64 | |