rp041993 hace 3 años
padre
commit
0acb6b97b4
Se han modificado 3 ficheros con 58 adiciones y 8 borrados
  1. 1 1
      config.py
  2. 3 3
      service/reports_service.py
  3. 54 4
      utils/Email.py

+ 1 - 1
config.py

@@ -1,6 +1,6 @@
 SECRET_KEY='sacC2p7rFaljsacC' # Secret key for flask project
 MONGO_DBNAME='Migration' # Database name
-MONGO_URI='mongodb://kefOnboard:sacC2p7rFaLj@142.93.210.143:27017/Migration' # MongoDB URI
+MONGO_URI='mongodb://kefOnboard:sacC2p7rFaLj@ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:27017/Migration' # MongoDB URI
 
 TEMPLATES_AUTO_RELOAD=True
 PORT=9005 # Flask running port

+ 3 - 3
service/reports_service.py

@@ -34,7 +34,7 @@ def getMouReportDataService(from_date, to_date, mongo):
                                                       1000).strftime("%x")
 
                 if 'mou_file' in mou:
-                    mou_file = "http://142.93.210.143:9005/uploads/" + mou[
+                    mou_file = "http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/" + mou[
                         'mou_file']
 
                 insert_obj = {
@@ -556,7 +556,7 @@ def getVoucherMISReportDataService(from_date, to_date, mongo):
                 
                 invoice_url=[]
                 for invoice in voucher['invoices']:
-                    invoice_url.append('http://142.93.210.143:9005/uploads/'+invoice)
+                    invoice_url.append('http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/'+invoice)
                 
 
                 insert_obj = {
@@ -601,7 +601,7 @@ def getVoucherMISReportDataService(from_date, to_date, mongo):
                         insert_obj['vendor_name'+str(k)]=quotation['v_name']
                         insert_obj['exception'+str(k)]=quotation['exception']
                         insert_obj['note'+str(k)]=quotation['note']
-                        insert_obj['quote_file'+str(k)]='http://142.93.210.143:9005/uploads/'+quotation['quote_file']
+                        insert_obj['quote_file'+str(k)]='http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/'+quotation['quote_file']
                         k+=1
                 else:
                     for k in range(1,4):

+ 54 - 4
utils/Email.py

@@ -5,6 +5,54 @@ from email.mime.text import MIMEText
 from email.mime.base import MIMEBase
 from email import encoders
 
+# def sendEmail(file_name,reciever_email,body,pdf_attach,subject):
+#     # send_attachment.py
+#     try:
+#         # create message object instance
+#         msg = MIMEMultipart()
+        
+#         # setup the parameters of the message
+#         password = "kefonboard@2020"
+#         msg['From'] = "admin@abacussoftware.services"
+#         msg['To'] = reciever_email
+#         msg['Subject'] = subject
+        
+#         msg.attach(MIMEText(body, 'html'))
+
+#         if pdf_attach==True:
+#             try:
+#                 pdfname='po_pdf/'+file_name
+#                 # open the file in bynary
+#                 binary_pdf = open(pdfname, 'rb')
+                
+#                 payload = MIMEBase('application', 'octate-stream', Name='po_pdf.pdf')
+#                 payload.set_payload((binary_pdf).read())
+                
+#                 # enconding the binary into base64
+#                 encoders.encode_base64(payload)
+            
+#                 # add header with pdf name
+#                 payload.add_header('Content-Decomposition', 'attachment', filename=pdfname)
+#                 msg.attach(payload)
+#             except Exception as err:
+#                 print('pdf attach  err',err)
+        
+#         # create server
+#         server = smtplib.SMTP('bom15.balasai.com: 587')
+#         server.starttls()
+        
+#         # Login Credentials for sending the mail
+#         server.login(msg['From'], password)
+        
+#         # send the message via the server.
+#         server.sendmail(msg['From'], msg['To'], msg.as_string())
+        
+#         server.quit()
+        
+#         print('Email sent')
+#     except Exception as err:
+#         print(err)
+
 def sendEmail(file_name,reciever_email,body,pdf_attach,subject):
     # send_attachment.py
     try:
@@ -12,8 +60,10 @@ def sendEmail(file_name,reciever_email,body,pdf_attach,subject):
         msg = MIMEMultipart()
         
         # setup the parameters of the message
-        password = "kefonboard@2020"
-        msg['From'] = "admin@abacussoftware.services"
+        # password = "kefonboard@2020"
+        password = "onboardkef@2021"
+        # msg['From'] = "admin@abacussoftware.services"
+        msg['From'] = "onboard@kotakeducationfoundation.org"
         msg['To'] = reciever_email
         msg['Subject'] = subject
         
@@ -37,8 +87,8 @@ def sendEmail(file_name,reciever_email,body,pdf_attach,subject):
             except Exception as err:
                 print('pdf attach  err',err)
         
-        # create server
-        server = smtplib.SMTP('bom15.balasai.com: 587')
+        
+        server =smtplib.SMTP('smtp.gmail.com', 587)
         server.starttls()
         
         # Login Credentials for sending the mail