A container for email information.
| 238 | |
| 239 | |
| 240 | class EmailMessage: |
| 241 | """A container for email information.""" |
| 242 | |
| 243 | content_subtype = "plain" |
| 244 | |
| 245 | # Undocumented charset to use for text/* message bodies and attachments. |
| 246 | # If None, defaults to settings.DEFAULT_CHARSET. |
| 247 | encoding = None |
| 248 | |
| 249 | @deprecate_posargs( |
| 250 | RemovedInDjango70Warning, |
| 251 | [ |
| 252 | "bcc", |
| 253 | "connection", |
| 254 | "attachments", |
| 255 | "headers", |
| 256 | "cc", |
| 257 | "reply_to", |
| 258 | ], |
| 259 | ) |
| 260 | def __init__( |
| 261 | self, |
| 262 | subject="", |
| 263 | body="", |
| 264 | from_email=None, |
| 265 | to=None, |
| 266 | *, |
| 267 | bcc=None, |
| 268 | connection=None, |
| 269 | attachments=None, |
| 270 | headers=None, |
| 271 | cc=None, |
| 272 | reply_to=None, |
| 273 | ): |
| 274 | """ |
| 275 | Initialize a single email message (which can be sent to multiple |
| 276 | recipients). |
| 277 | """ |
| 278 | if to: |
| 279 | if isinstance(to, str): |
| 280 | raise TypeError('"to" argument must be a list or tuple') |
| 281 | self.to = list(to) |
| 282 | else: |
| 283 | self.to = [] |
| 284 | if cc: |
| 285 | if isinstance(cc, str): |
| 286 | raise TypeError('"cc" argument must be a list or tuple') |
| 287 | self.cc = list(cc) |
| 288 | else: |
| 289 | self.cc = [] |
| 290 | if bcc: |
| 291 | if isinstance(bcc, str): |
| 292 | raise TypeError('"bcc" argument must be a list or tuple') |
| 293 | self.bcc = list(bcc) |
| 294 | else: |
| 295 | self.bcc = [] |
| 296 | if reply_to: |
| 297 | if isinstance(reply_to, str): |
no outgoing calls