Lines Matching refs:cte
144 def _encode_text(string, charset, cte, policy):
149 if cte is None:
164 cte = 'base64'
166 cte = 'quoted-printable'
168 return cte, sniff_qp
169 if cte == '7bit':
171 elif cte == '8bit':
173 elif cte == 'quoted-printable':
176 elif cte == 'base64':
179 raise ValueError("Unknown content transfer encoding {}".format(cte))
180 return cte, data
183 def set_text_content(msg, string, subtype="plain", charset='utf-8', cte=None,
187 cte, payload = _encode_text(string, charset, cte, msg.policy)
192 msg['Content-Transfer-Encoding'] = cte
197 def set_message_content(msg, message, subtype="rfc822", cte=None,
203 if cte not in (None, '7bit', '8bit', 'binary'):
206 "message/rfc822 parts do not support cte={}".format(cte))
212 cte = '8bit' if cte is None else cte
214 if cte not in (None, '7bit'):
217 "message/external-body parts do not support cte={}".format(cte))
218 cte = '7bit'
219 elif cte is None:
222 cte = '7bit'
225 msg['Content-Transfer-Encoding'] = cte
230 def set_bytes_content(msg, data, maintype, subtype, cte='base64',
234 if cte == 'base64':
236 elif cte == 'quoted-printable':
242 elif cte == '7bit':
244 elif cte in ('8bit', 'binary'):
247 msg['Content-Transfer-Encoding'] = cte