@@ -368,47 +368,6 @@ def cleanup_start():
368
368
os .chdir (root_location )
369
369
370
370
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
-
412
371
def onedrive_run_check ():
413
372
import psutil
414
373
for p in psutil .process_iter (attrs = ['pid' , 'name' ]):
@@ -463,8 +422,6 @@ def files_move():
463
422
db_id = 0
464
423
dldir = 'Downloads'
465
424
run_all (db_id )
466
- if config .get ('email' , 'email_on' ) == '1' :
467
- email_report ()
468
425
if config .get ('options' , 'onedrive' ) == '1' :
469
426
onedrive_run_check ()
470
427
cleanup_start ()
0 commit comments