diff --git a/main/models.py b/main/models.py index c752cd333d2611e83bdcddd312b55250a8b85bd8..d23252bb1c1bf562e267edfb8dce524a2241237d 100644 --- a/main/models.py +++ b/main/models.py @@ -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(