add automatic signature detection to email, based on pre-defined text or custom creation

This commit is contained in:
WorldTeacher
2024-05-21 14:07:55 +02:00
parent dc1f446017
commit 6a5116ea3f

View File

@@ -38,6 +38,7 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
self.subject = app_subject self.subject = app_subject
self.profname = prof_name self.profname = prof_name
self.mail_data = "" self.mail_data = ""
self.signature = self.determine_signature()
self.prof_mail = prof_mail self.prof_mail = prof_mail
self.comboBox.currentIndexChanged.connect(self.set_mail) self.comboBox.currentIndexChanged.connect(self.set_mail)
self.prof_name.setText(prof_name) self.prof_name.setText(prof_name)
@@ -67,6 +68,15 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
# # assign data["general"] to self.data # # assign data["general"] to self.data
# self.data = data["general"] # self.data = data["general"]
def determine_signature(self):
if config.mail.signature == None:
return """Mit freundlichen Grüßen
Ihr Semesterapparatsteam
Mail: semesterapparate@ph-freiburg.de
Tel.: 0761/682-778"""
else:
return config.mail.signature
def load_mail_templates(self): def load_mail_templates(self):
print("loading mail templates") print("loading mail templates")
@@ -108,6 +118,7 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
AppNr=self.appid, AppNr=self.appid,
AppSubject=self.subject, AppSubject=self.subject,
greeting=self.get_greeting(), greeting=self.get_greeting(),
signature=self.signature,
) )
self.mail_body.setHtml(mail_html) self.mail_body.setHtml(mail_html)