""" Copyright 2018 Attunity Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ """ Copyright 2018 Attunity Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ # coding: utf-8 import os, datetime, fileinput, shutil import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import configparser import subprocess def emailsupport(messagetype, messagefile): """Send to Email""" me = GGENV = "Qlik_Admin@LibertyMutual.com" you = ['HTTP_509@LibertyMutual.com', 'PMEDW_Prod_Support@LibertyMutual.com', 'QLIK_ADMIN@LibertyMutual.com'] #you = ['Wendell.Jones@libertymutual.com'] #you = CONFIG.get('global', 'receivers').split() # Open a plain text file for reading. For this example, assume that # the text file contains only ASCII characters. message_part = open(messagefile, 'r') part2 = MIMEText(message_part.read(), 'html') # Create a text/plain message message_part.close() msg = MIMEMultipart('alternative') msg['Subject'] = messagetype msg['From'] = me msg['To'] = ",".join(you) msg.attach(part2) # Send the message via our own SMTP server, but don't include the envelope header. sendmail(me, you, msg.as_string()) # Set header automation statement for email def openemail(emailfile): emailfile.write("
THIS IS AN AUTOMATED NOTIFICATION. PLEASE DO NOT RESPOND TO THIS E-MAIL.
") emailfile.write("\n") emailfile.write("THIS IS AN AUTOMATED NOTIFICATION. PLEASE DO NOT RESPOND TO THIS E-MAIL.
") emailfile.write("\t") emailfile.write("