исправлена почта, доработаны кп, добавление менеджеров, особенности хат

This commit is contained in:
Andron666
2023-01-19 19:16:42 +05:00
parent ac182257f1
commit 683a255878
71 changed files with 25 additions and 19 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
import requests # pip install requests
import sys
argc = 3 # argv[0] - script name, argv[1] - url, argv[2] - file output
if len(sys.argv) != argc:
sys.exit()
request = requests.get(sys.argv[1], allow_redirects=True)
open(sys.argv[2], 'wb').write(request.content)
+97
View File
@@ -0,0 +1,97 @@
import smtplib # Импортируем библиотеку по работе с SMTP
import os # Функции для работы с операционной системой, не зависящие от используемой операционной системы
# Добавляем необходимые подклассы - MIME-типы
import mimetypes # Импорт класса для обработки неизвестных MIME-типов, базирующихся на расширении файла
from email import encoders # Импортируем энкодер
from email.mime.base import MIMEBase # Общий тип
from email.mime.text import MIMEText # Текст/HTML
from email.mime.image import MIMEImage # Изображения
from email.mime.audio import MIMEAudio # Аудио
from email.mime.multipart import MIMEMultipart # Многокомпонентный объект
import sys # для чтения аргументов
#импорт аргументов
if len(sys.argv)==5:
addr_to = sys.argv[1]
filefold = sys.argv[2]
msgText = sys.argv[3]
msgTheme = sys.argv[4]
print(addr_to)
print(filefold)
else:
sys.exit()
def send_email(addr_to, msg_subj, msg_text, files):
addr_from = "reception@fortisgroup.ru" # Отправитель
#addr_from = sys.argv[1]
password = "123432Reception" # Пароль
msg = MIMEMultipart() # Создаем сообщение
msg['From'] = addr_from # Адресат
msg['To'] = addr_to # Получатель
msg['Subject'] = msg_subj # Тема сообщения
body = msg_text # Текст сообщения
msg.attach(MIMEText(body, 'html')) # Добавляем в сообщение текст
process_attachement(msg, files)
#======== Этот блок настраивается для каждого почтового провайдера отдельно ===============================================
server = smtplib.SMTP_SSL('Mail.nic.ru',465) # Создаем объект SMTP
server.ehlo()
#server.set_debuglevel(1)
#server.starttls() # Начинаем шифрованный обмен по TLS
server.login(addr_from, password) # Получаем доступ
# server.auth_plain()
server.send_message(msg) # Отправляем сообщение
server.quit() # Выходим
#==========================================================================================================================
def process_attachement(msg, files): # Функция по обработке списка, добавляемых к сообщению файлов
for f in files:
if os.path.isfile(f): # Если файл существует
attach_file(msg,f) # Добавляем файл к сообщению
elif os.path.exists(f): # Если путь не файл и существует, значит - папка
dir = os.listdir(f) # Получаем список файлов в папке
for file in dir: # Перебираем все файлы и...
print(f+"/"+file)
attach_file(msg,f+"/"+file) # ...добавляем каждый файл к сообщению
def attach_file(msg, filepath): # Функция по добавлению конкретного файла к сообщению
filename = os.path.basename(filepath) # Получаем только имя файла
ctype, encoding = mimetypes.guess_type(filepath) # Определяем тип файла на основе его расширения
if ctype is None or encoding is not None: # Если тип файла не определяется
ctype = 'application/octet-stream' # Будем использовать общий тип
maintype, subtype = ctype.split('/', 1) # Получаем тип и подтип
if maintype == 'text': # Если текстовый файл
with open(filepath) as fp: # Открываем файл для чтения
file = MIMEText(fp.read(), _subtype=subtype) # Используем тип MIMEText
fp.close() # После использования файл обязательно нужно закрыть
elif maintype == 'image': # Если изображение
with open(filepath, 'rb') as fp:
file = MIMEImage(fp.read(), _subtype=subtype)
fp.close()
elif maintype == 'audio': # Если аудио
with open(filepath, 'rb') as fp:
file = MIMEAudio(fp.read(), _subtype=subtype)
fp.close()
else: # Неизвестный тип файла
with open(filepath, 'rb') as fp:
file = MIMEBase(maintype, subtype) # Используем общий MIME-тип
file.set_payload(fp.read()) # Добавляем содержимое общего типа (полезную нагрузку)
fp.close()
encoders.encode_base64(file) # Содержимое должно кодироваться как Base64
file.add_header('Content-Disposition', 'attachment', filename=filename) # Добавляем заголовки
msg.attach(file) # Присоединяем файл к сообщению
# Использование функции send_email # Получатель
files = []
files = [filefold] # Список файлов, если вложений нет, то files=[]
# Если нужно отправить все файлы из заданной папки, нужно указать её
print("here i send mail")
send_email(addr_to, msgTheme, msgText, files)
Binary file not shown.
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
Кагарманова Анна - kagarmanova.av@fortisgroup.ru
Ленская Елена - lenskaya.es@fortisgroup.ru
Шахоткин Владимир - shahotkin.vu@fortisgroup.ru
Кулешова Марина - Kuleshova.mv@fortisgroup.ru
Тумашов Илья Викторович - tumashov.iv@fortisgroup.ru
Test user - andronchik92@gmail.com
Binary file not shown.