Signed-off-by: Max Schillinger <max@mxsr.de>
---
Just an idea. Totally untested!
listssrht-lmtp | 34 +++++++++++++++++-----------------listssrht/process.py | 1 +
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/listssrht-lmtp b/listssrht-lmtp
index 30a171e..349b165 100755
--- a/listssrht-lmtp+++ b/listssrht-lmtp
@@ -33,62 +33,62 @@ posting_domain = cfg("lists.sr.ht", "posting-domain")
html_error = """Hi {}!
-We received your email, but were unable to deliver it because it-contains HTML. HTML emails are not permitted. The following guide can+We received your email, but were unable to deliver it because it +contains HTML. HTML emails are not permitted. The following guide can help you configure your client to send in plain text instead:
https://useplaintext.email
-If you have any questions, please reply to this email to reach the mail+If you have any questions, please reply to this email to reach the mail admin. We apologise for the inconvenience.
"""
forbidden_mimetype_error = """Hi {}!
-We received your email, but were unable to deliver it because it-contains content which has been blacklisted by the list admin. Please+We received your email, but were unable to deliver it because it +contains content which has been blacklisted by the list admin. Please remove your {} attachments and send again.
-You are also advised to configure your email client to send emails in+You are also advised to configure your email client to send emails in plain text to avoid additional errors in the future:
https://useplaintext.email
-If you have any questions, please reply to this email to reach the mail+If you have any questions, please reply to this email to reach the mail admin. We apologise for the inconvenience.
"""
text_plain_required_error = """Hi {}!
-We received your email, but were unable to deliver it because there were-no text/plain parts. Our mail system requires all emails to have at-least one plain text part. The following guide can help you configure+We received your email, but were unable to deliver it because there were +no text/plain parts. Our mail system requires all emails to have at +least one plain text part. The following guide can help you configure your client to send in plain text:
https://useplaintext.email
-If you have any questions, please reply to this email to reach the mail+If you have any questions, please reply to this email to reach the mail admin. We apologise for the inconvenience.
"""
unknown_mailing_list_error = """Hi {}!
-We received your email, but were unable to deliver it because the-mailing list you wrote to was not found. The correct posting addresses+We received your email, but were unable to deliver it because the +mailing list you wrote to was not found. The correct posting addresses are:
~username/list-name@{}
-Or if your mail system has trouble sending to addresses with ~ or / in+Or if your mail system has trouble sending to addresses with ~ or / in them, you can use:
u.username.list-name@{}
-If your mail system does not support our normal posting addresses, we-would appreciate it if you wrote to your mail admin to ask them to fix+If your mail system does not support our normal posting addresses, we +would appreciate it if you wrote to your mail admin to ask them to fix their system. Our posting addresses are valid per RFC-5322.
-If you have any questions, please reply to this email to reach the mail+If you have any questions, please reply to this email to reach the mail admin. We apologise for the inconvenience.
"""
diff --git a/listssrht/process.py b/listssrht/process.py
index 8fced13..6c4d61e 100644
--- a/listssrht/process.py+++ b/listssrht/process.py
@@ -623,6 +623,7 @@ def send_error_for(mail_b64, error):
reply["Date"] = formatdate()
reply["Message-ID"] = make_msgid()
reply["Auto-Submitted"] = "auto-replied"
+ reply["Content-Type"] = 'text/plain; charset="us-ascii"; format=flowed' print(reply.as_string())
smtp = start_smtp()
sender = parseaddr(mail["From"])
--
2.44.0
On Thu Apr 18, 2024 at 9:03 PM CEST, Max Schillinger wrote:
> diff --git a/listssrht/process.py b/listssrht/process.py> index 8fced13..6c4d61e 100644> --- a/listssrht/process.py> +++ b/listssrht/process.py> @@ -623,6 +623,7 @@ def send_error_for(mail_b64, error):> reply["Date"] = formatdate()> reply["Message-ID"] = make_msgid()> reply["Auto-Submitted"] = "auto-replied"> + reply["Content-Type"] = 'text/plain; charset="us-ascii"; format=flowed'> print(reply.as_string())> smtp = start_smtp()> sender = parseaddr(mail["From"])
This seems like too little. You know that meme with Aragorn
saying “One does not simply enter Mordor” [1]? One does not simply
make message into format=flowed by adding one header. [2]
# When creating flowed text, the generating agent wraps, that is,
# inserts 'soft' line breaks as needed. Soft line breaks are added at
# natural wrapping points, such as between words. A soft line break is
# a SP CRLF sequence.
All lines should be gone through and all flowed lines should be
finished with <space>CRLF.
Best,
Matěj
[1] https://knowyourmeme.com/memes/one-does-not-simply-walk-into-mordor
[2] https://datatracker.ietf.org/doc/html/rfc3676
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
Somewhere at the edge of the Bell curve was the girl for me.
-- Based on https://xkcd.com/314/
On Fri Apr 19, 2024 at 3:12 PM CEST, Matěj Cepl wrote:
> This seems like too little. You know that meme with Aragorn> saying “One does not simply enter Mordor” [1]? One does not simply> make message into format=flowed by adding one header. [2]>> # When creating flowed text, the generating agent wraps, that is,> # inserts 'soft' line breaks as needed. Soft line breaks are added at> # natural wrapping points, such as between words. A soft line break is> # a SP CRLF sequence.>> All lines should be gone through and all flowed lines should be> finished with <space>CRLF.
It's not easy to see but I have added spaces at the line ends manually.
I don't know if this results in <space>CRLF or <space>LF line endings. I
also don't know if the CR matters on the receiver's side. It probably
depends on the mail client.
Best,
Max
Quoth Matěj Cepl:
>This seems like too little. You know that meme with Aragorn>saying “One does not simply enter Mordor” [1]? One does not simply>make message into format=flowed by adding one header. [2]>># When creating flowed text, the generating agent wraps, that is,># inserts 'soft' line breaks as needed. Soft line breaks are added at># natural wrapping points, such as between words. A soft line break is># a SP CRLF sequence.>>All lines should be gone through and all flowed lines should be>finished with <space>CRLF.>>Best,>>Matěj>>[1] https://knowyourmeme.com/memes/one-does-not-simply-walk-into-mordor>[2] https://datatracker.ietf.org/doc/html/rfc3676
All true, but do note that text/plain itself is defined to use
CRLF.¹ Using LF as line breaks in format=fixed text/plain is plain
wrong already—or as wrong as it gets when the RFCs say something
silly. And I submit that if the MUAs treat LF as line breaks in
format=fixed, they’ll treat SPLF as flowed line break.
¹ https://datatracker.ietf.org/doc/html/rfc2046#section-4.1.1
On Sat Apr 20, 2024 at 6:34 PM CEST, Lennart Jablonka wrote:
> All true, but do note that text/plain itself is defined to use > CRLF.¹ Using LF as line breaks in format=fixed text/plain is plain > wrong already—or as wrong as it gets when the RFCs say something > silly. And I submit that if the MUAs treat LF as line breaks in > format=fixed, they’ll treat SPLF as flowed line break.
CRLF v LF is yet another can of worms I had to deal with (my
$EDITOR is apparently the only which works only one with native
EOL only [1] and [2]). However, it should be probably OK to add
CRLF as $EDITOR and lf-editor=true should deal with it, somehow.
Best,
Matěj
[1] https://lists.sr.ht/~rjarry/aerc-devel/patches/44276
[2] https://lists.sr.ht/~rjarry/aerc-devel/%3Cda4622a6-d605-4446-ab88-26e6359a5127@milic.suse.cz%3E
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
A philosopher like Plato, according to Luther’s colorful imagery,
remains like a cow who looks at a new door, refusing to enter?
This patch looks good to me, but per the comments perhaps this would be
a good opportunity to use CRLF here. Can you respin the patch with that
addition? Just stick \r at the end of every line and call it a day.
On Wed May 22, 2024 at 2:44 PM CEST, Drew DeVault wrote:
> This patch looks good to me, but per the comments perhaps this would be> a good opportunity to use CRLF here. Can you respin the patch with that> addition? Just stick \r at the end of every line and call it a day.
Are you sure, the '\r' is really missing? I can't find the original
e-mail anymore but a similar e-mail with an `unknown_mailing_list_error`
seems to contain CRLF line endings:
$ cat --show-all /tmp/mail
Hi Max Schillinger!^M$
^M$
We received your email, but were unable to deliver it because the^M$
mailing list you wrote to was not found. The correct posting addresses^M$
are:^M$
^M$
~username/list-name@lists.sr.ht^M$
I think that either a Python module turns LF into CRLF automatically or
aerc "fixed" it on the receiving end. I'll try to find it out.
On Wed May 22, 2024 at 7:26 PM CEST, Max Schillinger wrote:
> I think that either a Python module turns LF into CRLF automatically > or aerc "fixed" it on the receiving end. I'll try to find it out.
`lists.sr.ht/listssrht/process.py` sends e-mails via
`smtplib.SMTP.send_message`. And this seems to use CRLF as line
separator automatically:
> `send_message` serializes `msg` using BytesGenerator with `\r\n` as > the linesep, and calls `sendmail()` to transmit the resulting message.https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message
Then I can leave the line endings as they are, right?
On Wed May 22, 2024 at 8:48 PM CEST, Max Schillinger wrote:
> > `send_message` serializes `msg` using BytesGenerator with `\r\n` as > > the linesep, and calls `sendmail()` to transmit the resulting message.>> https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message>> Then I can leave the line endings as they are, right?
(sorry for the delay, have been very busy)
Okay, we can leave the line endings as-is. Will put this back on my
patch queue.
On Wed Jul 24, 2024 at 11:11 AM CEST, Drew DeVault wrote:
> Ah, I just noticed that this was sent to the wrong mailing list. Can you> send it to sr.ht-dev?
Sure! Now it's here:
<https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/54060>