Return the entire formatted message as a string. Optional `unixfrom' when True, means include the Unix From_ envelope header. This overrides the default as_string() implementation to not mangle lines that begin with 'From '. See bug #13433 for details.
(self, unixfrom=False, linesep="\n")
| 162 | # RemovedInDjango70Warning. |
| 163 | class MIMEMixin: |
| 164 | def as_string(self, unixfrom=False, linesep="\n"): |
| 165 | """Return the entire formatted message as a string. |
| 166 | Optional `unixfrom' when True, means include the Unix From_ envelope |
| 167 | header. |
| 168 | |
| 169 | This overrides the default as_string() implementation to not mangle |
| 170 | lines that begin with 'From '. See bug #13433 for details. |
| 171 | """ |
| 172 | fp = StringIO() |
| 173 | g = generator.Generator(fp, mangle_from_=False) |
| 174 | g.flatten(self, unixfrom=unixfrom, linesep=linesep) |
| 175 | return fp.getvalue() |
| 176 | |
| 177 | def as_bytes(self, unixfrom=False, linesep="\n"): |
| 178 | """Return the entire formatted message as bytes. |