@@ -70,7 +70,7 @@ def _forbid_multi_line_headers(
7070 name : str , val : str , encoding : str | None
7171) -> tuple [str , str ]:
7272 """Forbid multi-line headers to prevent header injection."""
73- encoding = encoding or settings . DEFAULT_CHARSET
73+ encoding = encoding or "utf-8"
7474 val = str (val ) # val may be lazy
7575 if "\n " in val or "\r " in val :
7676 raise BadHeaderError (
@@ -281,7 +281,7 @@ def get_connection(self, fail_silently: bool = False) -> BaseEmailBackend:
281281 return self .connection
282282
283283 def message (self ) -> SafeMIMEText | SafeMIMEMultipart :
284- encoding = self .encoding or settings . DEFAULT_CHARSET
284+ encoding = self .encoding or "utf-8"
285285 msg = SafeMIMEText (self .body , self .content_subtype , encoding )
286286 msg = self ._create_message (msg )
287287 msg ["Subject" ] = self .subject
@@ -391,7 +391,7 @@ def _create_attachments(
391391 self , msg : SafeMIMEText | SafeMIMEMultipart
392392 ) -> SafeMIMEText | SafeMIMEMultipart :
393393 if self .attachments :
394- encoding = self .encoding or settings . DEFAULT_CHARSET
394+ encoding = self .encoding or "utf-8"
395395 body_msg = msg
396396 msg = SafeMIMEMultipart (_subtype = self .mixed_subtype , encoding = encoding )
397397 if self .body or body_msg .is_multipart ():
@@ -414,7 +414,7 @@ def _create_mime_attachment(
414414 """
415415 basetype , subtype = mimetype .split ("/" , 1 )
416416 if basetype == "text" :
417- encoding = self .encoding or settings . DEFAULT_CHARSET
417+ encoding = self .encoding or "utf-8"
418418 if not isinstance (content , str ):
419419 content = force_str (content )
420420 attachment = SafeMIMEText (content , subtype , encoding )
@@ -528,7 +528,7 @@ def _create_message(self, msg: SafeMIMEText) -> SafeMIMEText | SafeMIMEMultipart
528528 def _create_alternatives (
529529 self , msg : SafeMIMEText | SafeMIMEMultipart
530530 ) -> SafeMIMEText | SafeMIMEMultipart :
531- encoding = self .encoding or settings . DEFAULT_CHARSET
531+ encoding = self .encoding or "utf-8"
532532 if self .alternatives :
533533 body_msg = msg
534534 msg = SafeMIMEMultipart (
0 commit comments