fix broken files after faulty update
This commit is contained in:
@@ -4,14 +4,12 @@ import sys
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from src import Icon, settings as config
|
||||
from src.logic.log import MyLogger
|
||||
|
||||
|
||||
from .dialog_sources.Ui_mail_preview import Ui_eMailPreview as MailPreviewDialog
|
||||
from .mailTemplate import MailTemplateDialog
|
||||
|
||||
|
||||
logger = MyLogger("Mail")
|
||||
|
||||
empty_signature = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style
|
||||
@@ -52,7 +50,7 @@ class Mail_Dialog(QtWidgets.QDialog, MailPreviewDialog):
|
||||
# prof_name,
|
||||
)
|
||||
|
||||
logger.log_info("Setting up mail dialog")
|
||||
logger.info("Setting up mail dialog")
|
||||
self.appid = app_id
|
||||
self.appname = app_name
|
||||
self.subject = app_subject
|
||||
@@ -84,7 +82,7 @@ class Mail_Dialog(QtWidgets.QDialog, MailPreviewDialog):
|
||||
self.btn_okay.clicked.connect(self.createAndSendMail)
|
||||
|
||||
def open_new_template(self):
|
||||
logger.log_info("Opening new template dialog")
|
||||
logger.info("Opening new template dialog")
|
||||
# TODO: implement new mail template dialog
|
||||
dialog = MailTemplateDialog()
|
||||
dialog.exec()
|
||||
@@ -101,9 +99,9 @@ Tel.: 0761/682-778 | 07617682-545"""
|
||||
|
||||
def load_mail_templates(self):
|
||||
# print("loading mail templates")
|
||||
logger.log_info("Loading mail templates")
|
||||
logger.info("Loading mail templates")
|
||||
mail_templates = os.listdir("mail_vorlagen")
|
||||
logger.log_info(f"Mail templates: {mail_templates}")
|
||||
logger.info(f"Mail templates: {mail_templates}")
|
||||
for template in mail_templates:
|
||||
self.comboBox.addItem(template)
|
||||
|
||||
@@ -121,10 +119,10 @@ Tel.: 0761/682-778 | 07617682-545"""
|
||||
return f"Guten Tag {name},"
|
||||
|
||||
def set_mail(self):
|
||||
logger.log_info("Setting mail")
|
||||
logger.info("Setting mail")
|
||||
email_template = self.comboBox.currentText()
|
||||
if email_template == "":
|
||||
logger.log_debug("No mail template selected")
|
||||
logger.debug("No mail template selected")
|
||||
return
|
||||
with open(f"mail_vorlagen/{email_template}", "r", encoding="utf-8") as f:
|
||||
mail_template = f.read()
|
||||
@@ -147,10 +145,10 @@ Tel.: 0761/682-778 | 07617682-545"""
|
||||
)
|
||||
|
||||
self.mail_body.setHtml(mail_html)
|
||||
logger.log_info(f"Mail template set to {email_template}")
|
||||
logger.info(f"Mail template set to {email_template}")
|
||||
|
||||
def createAndSendMail(self):
|
||||
logger.log_info("Sending mail")
|
||||
logger.info("Sending mail")
|
||||
import smtplib
|
||||
import ssl
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
@@ -188,7 +186,7 @@ Tel.: 0761/682-778 | 07617682-545"""
|
||||
# print("Mail sent")
|
||||
# end active process
|
||||
server.quit()
|
||||
logger.log_info("Mail sent, closing connection to server and dialog")
|
||||
logger.info("Mail sent, closing connection to server and dialog")
|
||||
# close the dialog
|
||||
|
||||
self.accept()
|
||||
|
||||
Reference in New Issue
Block a user