Commits

FredGan  committed 5614f64

Отчеты по почте

  • Participants
  • Parent commits 6acf20b

Comments (0)

Files changed (2)

 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 ##########################################################################
 #BACKUP FILES company "AlieParusa"                                       #
 ##########################################################################
 import xml.parsers.expat
 import tarfile
 import os
+import modules
 from datetime import datetime
 
 #List of path backup from XML file with name is "path.xml"
         log.write(datetime.now().strftime('%Y'"."'%m'"."'%d'" "'%H'":"'%m')+" Finish task:\n")
         log.close()
         tar.close()
+#Send email          
+        modules.Sendemail(fro_m='service@redsails.ru', to='backup@redsails.ru', body='Job '+str(i)+' is done.' , subject='BackUP')
 #Run processing
 Archive(Path())
+#!/usr/bin/env python
+
+#There is additional function
+#Import extentions
+import smtplib
+from email.mime.text import MIMEText
+#Sending email
+def Sendemail(fro_m,to,subject,body):
+    msg = MIMEText(body)
+
+    msg['Subject'] = subject
+    msg['From'] = fro_m
+    msg['To'] = to
+
+    send = smtplib.SMTP('192.168.50.254')
+    send.sendmail(fro_m, to,  msg.as_string())
+    send.quit()