| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import os
- from lib.config import Config
- class konto:
- @property
- def SMTP(self) -> str:
- return self.__smtp
- @SMTP.setter
- def SMTP(self,value:str):
- self.__smtp = value
- @property
- def IMap(self) -> str:
- return self.__imap
- @IMap.setter
- def IMap(self,value:str):
- self.__imap = value
- @property
- def Pop3(self) -> str:
- return self.__pop3
- @Pop3.setter
- def Pop3(self,value:str):
- self.__pop3 = value
- @property
- def Username(self) -> str:
- return self.__username
- @Username.setter
- def Username(self,value:str):
- self.__username = value
- @property
- def Password(self) -> str:
- return self.__password
- @Password.setter
- def Password(self,value:str):
- self.__password = value
- @property
- def Name(self) -> str:
- return self.__name
- @Name.setter
- def Name(self,value:str):
- self.__name = value
- def Send(self, to:str, subject:str, message:str, template:str=None, header:dict={}):
- html:str = self.__loadTemplate(template)
- messageId = "Trixy-"
-
- def __loadTemplate(self, path:str) -> str:
- contents:str = self.__defaultTemplate()
- if path==None or path=="":
- return contents
- if os.path.exists(path):
- with open('the-zen-of-python.txt') as f:
- contents = f.read()
- else:
- print(f"E-Mail template not found: {path}")
- return contents
- def __defaultTemplate(self) -> str:
- return '%body%'
|