Skip to content

Commit c10acf0

Browse files
committed
-Unused code
Removed unused code, moved to devolpment branch (email reports)
1 parent b0358db commit c10acf0

File tree

2 files changed

+1
-55
lines changed

2 files changed

+1
-55
lines changed

project/src/1.1_e/config.ini.template

+1-12
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,4 @@ nas_location = X:\share\location
99
onedrive = 1
1010

1111
[selenium]
12-
headless = 1
13-
14-
[email]
15-
email_on = 1
16-
from = unused@domain.co.uk
17-
to = user@domain.co.uk
18-
19-
[email_server]
20-
smtp_server_addr = smtp.office365.com
21-
smtp_server_port = 587
22-
tls = 1
23-
smtp_pword = p@5sW0rD
12+
headless = 1

project/src/1.1_e/main_.py

-43
Original file line numberDiff line numberDiff line change
@@ -368,47 +368,6 @@ def cleanup_start():
368368
os.chdir(root_location)
369369

370370

371-
def email_report():
372-
latestlog_loc = logdir + '/info-latest.log'
373-
fromaddress = config.get('email', 'from')
374-
toaddress = config.get('email', 'to')
375-
smtp_server_addr = config.get('email_server', 'smtp_server_addr')
376-
smtp_server_port = config.get('email_server', 'smtp_server_port')
377-
tls_t = config.get('email_server', 'tls')
378-
if tls_t == '1':
379-
tls = True
380-
else:
381-
tls = False
382-
smtp_pword = config.get('email_server', 'smtp_pword')
383-
384-
import smtplib
385-
from email.mime.multipart import MIMEMultipart
386-
from email.mime.text import MIMEText
387-
from email.mime.base import MIMEBase
388-
from email import encoders
389-
msg = MIMEMultipart()
390-
msg['From'] = fromaddress
391-
msg['To'] = toaddress
392-
msg['Subject'] = 'Auto-backup OpenScape'
393-
logged = open(latestlog_loc)
394-
bodymsg = logged.read()
395-
msg.attach(MIMEText(bodymsg, 'plain'))
396-
attachment = open(latestlog_loc, "rb")
397-
p = MIMEBase('application', 'octet-stream')
398-
p.set_payload((attachment).read())
399-
encoders.encode_base64(p)
400-
p.add_header('Content-Disposition', "attachment; filename=latestlog.txt")
401-
msg.attach(p)
402-
s = smtplib.SMTP(smtp_server_addr, smtp_server_port)
403-
if tls is True:
404-
s.starttls()
405-
s.login(fromaddress, smtp_pword)
406-
text = msg.as_string()
407-
s.sendmail(fromaddress, toaddress, text)
408-
s.quit()
409-
print('Email report sent')
410-
411-
412371
def onedrive_run_check():
413372
import psutil
414373
for p in psutil.process_iter(attrs=['pid', 'name']):
@@ -463,8 +422,6 @@ def files_move():
463422
db_id = 0
464423
dldir = 'Downloads'
465424
run_all(db_id)
466-
if config.get('email', 'email_on') == '1':
467-
email_report()
468425
if config.get('options', 'onedrive') == '1':
469426
onedrive_run_check()
470427
cleanup_start()

0 commit comments

Comments
 (0)