From a2088d77450ff05e9801c38ba00f97b4de7c2c93 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 14 Sep 2022 23:50:59 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20contr=C3=B4le=20cotisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controle_cotisation/mail_instructions_headers.txt | 2 +- controle_cotisation/mail_recap_header.txt | 2 +- controle_cotisation/mail_recu_attachment.txt | 4 ++-- controle_cotisation/mail_recu_headers.txt | 2 +- controle_cotisation/main.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/controle_cotisation/mail_instructions_headers.txt b/controle_cotisation/mail_instructions_headers.txt index 1aaafa7..327aef4 100644 --- a/controle_cotisation/mail_instructions_headers.txt +++ b/controle_cotisation/mail_instructions_headers.txt @@ -3,5 +3,5 @@ From: =?UTF-8?Q?Tr=c3=a9sorier_de_Libre_en_Communs?= To: Subject: =?UTF-8?Q?=5bTr=c3=a9sorerie=5d_-_modalit=c3=a9s_de_r=c3=a8glement_de_vo?= =?UTF-8?Q?tre_cotisation_ANNEE_CIVILE?= -Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable \ No newline at end of file diff --git a/controle_cotisation/mail_recap_header.txt b/controle_cotisation/mail_recap_header.txt index 560205a..7f5fb7d 100644 --- a/controle_cotisation/mail_recap_header.txt +++ b/controle_cotisation/mail_recap_header.txt @@ -2,5 +2,5 @@ From: tresorier@a-lec.org To: tresorier@a-lec.org Subject: Suivi automatique des cotisations MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 +Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable \ No newline at end of file diff --git a/controle_cotisation/mail_recu_attachment.txt b/controle_cotisation/mail_recu_attachment.txt index a29e298..8330be1 100644 --- a/controle_cotisation/mail_recu_attachment.txt +++ b/controle_cotisation/mail_recu_attachment.txt @@ -1,4 +1,4 @@ --------------3yxkFgv0AINs5nd0i6BJrWaV -Content-Type: application/pdf; name="Recu_cotisation_ANNEE-CIVILE.pdf" -Content-Disposition: attachment; filename="Recu_cotisation_ANNEE-CIVILE.pdf" +Content-Type: application/pdf; name="Recu.pdf" +Content-Disposition: attachment; filename="Recu.pdf" Content-Transfer-Encoding: base64 \ No newline at end of file diff --git a/controle_cotisation/mail_recu_headers.txt b/controle_cotisation/mail_recu_headers.txt index 05a2bee..9646f1a 100644 --- a/controle_cotisation/mail_recu_headers.txt +++ b/controle_cotisation/mail_recu_headers.txt @@ -9,5 +9,5 @@ Content-Type: multipart/mixed; boundary="------------3yxkFgv0AINs5nd0i6BJrWaV" This is a multi-part message in MIME format. --------------3yxkFgv0AINs5nd0i6BJrWaV -Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable \ No newline at end of file diff --git a/controle_cotisation/main.py b/controle_cotisation/main.py index 7296a20..66d4183 100755 --- a/controle_cotisation/main.py +++ b/controle_cotisation/main.py @@ -106,7 +106,7 @@ def sendmail_with_attachment(headers, data, attachment_header, attachment, endin + quopri.encodestring(bytes(data, 'utf-8')) \ + bytes(attachment_header + "\n", 'utf-8') \ + base64.b64encode(attachment) \ - + bytes(ending + "\n", 'utf-8') + + bytes(ending, 'utf-8') subprocess.run([SENDMAIL_LOCATION, "-t", "-oi"], input=msg) @@ -342,7 +342,7 @@ def validate(member): data = attachment.read() attachment.close() - ending = "\n--------------3yxkFgv0AINs5nd0i6BJrWaV--" + ending = "--------------3yxkFgv0AINs5nd0i6BJrWaV--" sendmail_with_attachment(mailheaders, mailtext, mailtattach, data, ending)