Skip to content

Commit 8177739

Browse files
Merge pull request #7 from ethereum/fredriksvantes-patch-1
Fixed attachment issue
2 parents b950ffd + 9eac819 commit 8177739

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

server.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,26 @@ def create_email(to_email, identifier, text, all_attachments):
7878
"""
7979
plain_text = text.replace('<br />', '\n')
8080
message = Mail(
81-
from_email=FROMEMAIL,
82-
to_emails=to_email,
83-
subject=f'Secure Form Submission {identifier}',
84-
plain_text_content=plain_text
85-
)
81+
from_email=FROMEMAIL,
82+
to_emails=to_email,
83+
subject=f'Secure Form Submission {identifier}',
84+
plain_text_content=plain_text)
85+
86+
for item in all_attachments:
87+
filename = item['filename']
88+
attachment = item['attachment']
8689

87-
for filename, attachment in all_attachments:
8890
encoded_file = base64.b64encode(attachment.encode("utf-8")).decode()
89-
attached_file = Attachment(
91+
attachedFile = Attachment(
9092
FileContent(encoded_file),
9193
FileName(filename + '.pgp'),
9294
FileType('application/pgp-encrypted'),
9395
Disposition('attachment')
9496
)
95-
message.add_attachment(attached_file)
97+
message.add_attachment(attachedFile)
9698
return message
9799

100+
98101
def validate_recaptcha(recaptcha_response):
99102
"""
100103
Validates the ReCaptcha response.

0 commit comments

Comments
 (0)