Skip to content
Snippets Groups Projects
Commit 5e96eae9 authored by Alexa Valentová's avatar Alexa Valentová
Browse files

add recipient email

parent 097980d0
No related branches found
No related tags found
2 merge requests!1233Release,!1230add recipient email
Pipeline #20677 passed
......@@ -620,7 +620,26 @@ class MainCareerPage(
for file in form.cleaned_data["other_files"]:
other_files_names += f" - {file.name}\n"
email = EmailMessage(
recipient_email = EmailMessage(
# Subject
f"Potvrzení přihlášky k pracovní pozici {self.title}",
# Message
f"""
Dobrý den,
potvrzujeme přijetí Vaší přihlášky k pracovní pozici '{self.title}'.
Budeme vás co nejdříve kontaktovat s dalšími informacemi.
Děkujeme,
Pirátská Strana
""",
# From email
"vyberka@pirati.cz",
# To email
form.cleaned_data['email']
)
administrator_email = EmailMessage(
# Subject
f"Nová přihláška k pracovní pozici {self.title} - {form.cleaned_data['name']} {form.cleaned_data['surname']}",
# Message
......@@ -654,14 +673,14 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
)
form.cleaned_data["cv_file"].seek(0)
email.attach(
administrator_email.attach(
form.cleaned_data["cv_file"].name,
form.cleaned_data["cv_file"].read(),
form.cleaned_data["cv_file"].content_type,
)
form.cleaned_data["cover_letter_file"].seek(0)
email.attach(
administrator_email.attach(
form.cleaned_data["cover_letter_file"].name,
form.cleaned_data["cover_letter_file"].read(),
form.cleaned_data["cover_letter_file"].content_type,
......@@ -669,9 +688,12 @@ Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být p
for file in form.cleaned_data["other_files"]:
file.seek(0)
email.attach(file.name, file.read(), file.content_type)
administrator_email.attach(file.name, file.read(), file.content_type)
sent_successfully = email.send()
sent_successfully = (
administrator_email.send()
and recipient_email.send()
)
if sent_successfully:
messages.add_message(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment