куча херни
This commit is contained in:
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.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
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.
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.
@@ -0,0 +1,96 @@
|
||||
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)==3:
|
||||
addr_to = sys.argv[1]
|
||||
filefold = sys.argv[2]
|
||||
print(addr_to)
|
||||
print(filefold)
|
||||
else:
|
||||
sys.exit()
|
||||
|
||||
def send_email(addr_to, msg_subj, msg_text, files):
|
||||
addr_from = "sales@atlasgroup.su" # Отправитель
|
||||
#addr_from = sys.argv[1]
|
||||
password = "iTower163a" # Пароль
|
||||
|
||||
msg = MIMEMultipart() # Создаем сообщение
|
||||
msg['From'] = addr_from # Адресат
|
||||
msg['To'] = addr_to # Получатель
|
||||
msg['Subject'] = msg_subj # Тема сообщения
|
||||
|
||||
body = msg_text # Текст сообщения
|
||||
msg.attach(MIMEText(body, 'plain')) # Добавляем в сообщение текст
|
||||
|
||||
process_attachement(msg, files)
|
||||
|
||||
#======== Этот блок настраивается для каждого почтового провайдера отдельно ===============================================
|
||||
server = smtplib.SMTP_SSL('mail.atlasgroup.su',465) # Создаем объект SMTP
|
||||
#server.ehlo(addr_from)
|
||||
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()
|
||||
addr_to = "andronchik92@gmail.com" # Получатель
|
||||
|
||||
files = []
|
||||
files = [filefold] # Список файлов, если вложений нет, то files=[]
|
||||
# Если нужно отправить все файлы из заданной папки, нужно указать её
|
||||
print("here i send mail")
|
||||
send_email(addr_to, "Жилая экосистема 4YOU", "Благодарим за проявленный интерес к нашему объекту ЖК 4YOU. Мы подобрали для Вас наиболее удобные и выгодные варианты квартир в нашем комплексе. Они будут во вложении ниже.", files)
|
||||
@@ -0,0 +1,22 @@
|
||||
Add-Type @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
public class Util {
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetForegroundWindow();
|
||||
}
|
||||
"@
|
||||
$wshell = New-Object -ComObject wscript.shell;
|
||||
foreach($i in $args){
|
||||
|
||||
$app = Start-Process -FilePath $i -passThru -Verb Print
|
||||
start-sleep -m 200
|
||||
$wshell.AppActivate($app.Id)
|
||||
#start-sleep -m 200
|
||||
$wshell.SendKeys('{ENTER}')
|
||||
#Wait-Process -InputObject $app
|
||||
#start-sleep -m 200
|
||||
}
|
||||
sleep 10
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user