I have set an email notification in Fdmee (EPM 11.1.2.4) when the data load rule export completes. I have tested on Test environment Linux (Firewall OFF) and on Production environment Linux (Firewall ON). It is working on test environment but unable to work on Production environment due to Firewall ON and gives an error of Smtp Failed.
Please anyone help me how can i able send email on production environment. Please find below the error and custom script.
Error:
2018-08-17 19:18:26,998 DEBUG [AIF]: CommData.updateWorkflow - END
2018-08-17 19:18:26,998 DEBUG [AIF]: Comm.executeScript - START
2018-08-17 19:18:26,999 INFO [AIF]: Executing the following script: /u01/Oracle/FDMEE/HypLive/data/scripts/event/AftExportToDat.py
2018-08-17 19:18:27,012 INFO [AIF]: ---------Execution Block Begin---------
2018-08-17 19:18:27,013 INFO [AIF]: ---------Checking If LOC is GL---------
2018-08-17 19:18:27,013 INFO [AIF]: Location Passed = GL_LOC
2018-08-17 19:18:27,023 INFO [AIF]: ERROR: SMTP process failed: (-1, 'SSL handshake exception')
2018-08-17 19:18:27,023 INFO [AIF]: Mail Not Sent
AftExportToDat Script:
import smtplib
strLoc = fdmContext["LOCNAME"]
strCat = fdmContext["CATNAME"]
strPer = fdmContext["PERIODNAME"]
strFromAddress = "xyz@abc.com"
strToAddress = "xyz@abc.com"
strSubjectPV = "FDMEE RULE - Location: " + strLoc
strSubjectFV = "FDMEE RULE - Location: " + strLoc
strEmailMSGLinePV = "FDMEE Data Export was successful for Location:" + strLoc + ',' + "Category:" + strCat + ',' + "Period:" + strPer
strEmailMSGLineFV = "FDMEE Data Export was not processed or Failed for Location:" + strLoc + ',' + "Category:" + strCat + ',' + "Period:" + strPer + "."
strMessagePV = """\From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (strFromAddress, "," .join(strToAddress), strSubjectPV, strEmailMSGLinePV)
strMessageFV = """\From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (strFromAddress, "," .join(strToAddress), strSubjectFV, strEmailMSGLineFV)
fdmAPI.logInfo("---------Execution Block Begin---------")
fdmAPI.logInfo("---------Checking If LOC is GL---------")
fdmAPI.logInfo("Location Passed = " + strLoc)
if strLoc =="GL_LOC":
try:
smtpServer = smtplib.SMTP("10.xxx.xxx.xxx",25)
smtpServer.ehlo()
smtpServer.starttls()
stat = fdmAPI.getProcessStates(fdmContext["LOADID"])
fdmAPI.logInfo("Smtp server successful")
if str(stat["EXPSTATUS"]) == "0":
smtpServer.sendmail(strFromAddress, strToAddress, strMessagePV)
fdmAPI.logInfo("Mail Sent, Export Successful")
else:
smtpServer.sendmail(strFromAddress, strToAddress, strMessageFV)
smtpServer.quit()
fdmAPI.logInfo("Mail Sent, Export Not Successful")
except Exception, e:
fdmAPI.logInfo('ERROR: SMTP process failed: ' + str(e))
fdmAPI.logInfo("Mail Not Sent")
else:
fdmAPI.logInfo("======================================================================")
fdmAPI.logInfo("GL Location Not Selected")
fdmAPI.logInfo("======================================================================")
fdmAPI.logInfo("Mail Not Sent")
fdmAPI.logInfo("======================================================================")
fdmAPI.logInfo("Process: End")
fdmAPI.logInfo("======================================================================")