this is a test of a really long line that has more words that could possibl=
y fit in a single column of text.
When sending email, is there some maximum-linelength variable, or
something, that's truncating/breaking lines? Any way to prevent this
from happening?
Code I'm using to test:
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
from django.core.mail import send_mail
def send_letter(request):
the_text = 'this is a test of a really long line that has more
words that could possibly fit in a single column of text.'
send_mail('some_subject', the_text, 'm...@test.com', ['m...@test.com'])
Thanks.
John C>
> I'm using the filebased email backend for testing (although the console version had the same problem). When I send email, either via function or template, lines that are too long, are broken, with an '=' sign at the end. For instance:
>
> this is a test of a really long line that has more words that could possibl=
> y fit in a single column of text.
>
> When sending email, is there some maximum-linelength variable, or something, that's truncating/breaking lines? Any way to prevent this from happening?
The answer is no, it it the underlying python email.MIMEText object that is performing the encoding
The only encoding that isn;t going to wrap is charset="us-ascii"
http://www.rfc-editor.org/rfc/rfc5322.txt
2.1.1. Line Length Limits
There are two limits that this specification places on the number of
characters in a line. Each line of characters MUST be no more than
998 characters, and SHOULD be no more than 78 characters, excluding
the CRLF.
The 998 character limit is due to limitations in many implementations
that send, receive, or store IMF messages which simply cannot handle
more than 998 characters on a line. Receiving implementations would
do well to handle an arbitrarily large number of characters in a line
for robustness sake. However, there are so many implementations that
(in compliance with the transport requirements of [RFC5321]) do not
accept messages containing more than 1000 characters including the CR
and LF per line, it is important for implementations not to create
such messages.
The more conservative 78 character recommendation is to accommodate
the many implementations of user interfaces that display these
messages which may truncate, or disastrously wrap, the display of
more than 78 characters per line, in spite of the fact that such
implementations are non-conformant to the intent of this
specification (and that of [RFC5321] if they actually cause
information to be lost). Again, even though this limitation is put
on messages, it is incumbent upon implementations that display
messages to handle an arbitrarily large number of characters in a
line (certainly at least up to the 998 character limit) for the sake
of robustness.
Jason
>
> Code I'm using to test:
>
> EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
> from django.core.mail import send_mail
>
> def send_letter(request):
> the_text = 'this is a test of a really long line that has more words that could possibly fit in a single column of text.'
> send_mail('some_subject', the_text, 'm...@test.com', ['m...@test.com'])
>
> Thanks.
> John C>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
2.1.1 doesn't apply here, the email is simply formatted using the
Quoted-Printable transfer encoding.
http://en.wikipedia.org/wiki/Quoted-printable
An email client would read "=\r\n" as a soft line break, and remove it
when displaying the message.
Cheers
Tom
Actually, upon looking more at the output, it has *both* "utf-8" and
"us-ascii" as the charset.