%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
import mysql.connector import cx_Oracle import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText def sendemail(n): sender_email = "amit.verma@shardatech.org" # Replace with your sender email sender_password = "amit@90#v" # Replace with your sender email password receiver_email = "amit.verma@shardatech.org" # Replace with the recipient's email subject = "Notification Email" message = "Hello, this is a notification email. Total records:"+str(n) try: # Connect to Gmail's SMTP server server = smtplib.SMTP("smtp.gmail.com", 587) server.starttls() # Log in to your Gmail account server.login(sender_email, sender_password) # Create a MIME object for the email msg = MIMEMultipart() msg["From"] = sender_email msg["To"] = receiver_email msg["Subject"] = subject # Attach the message to the email msg.attach(MIMEText(message, "plain")) # Send the email server.sendmail(sender_email, receiver_email, msg.as_string()) print("Notification email sent successfully") except Exception as e: print("Error:", e) finally: # Disconnect from the server server.quit() # Replace these with your actual Oracle database credentials db_config = { 'user': 'ATTEST', 'password': 'TFsgt^I8', 'dsn': '35.154.115.237:9999/SHARDA' # This should be in the format 'hostname:port/service_name' } # Replace these with your actual MySQL database credentials mysql_db_config = { 'host': 'admissions.cluster-custom-c8m5zlhotfbm.ap-south-1.rds.amazonaws.com', 'user': 'shardezone_user', 'password': '7se%;pr*/A24AyTw', 'database': 'shardaac_ezone_2022_db' } try: # Establish a connection to the Oracle database connection = cx_Oracle.connect(**db_config) mysqlconnection = mysql.connector.connect(**mysql_db_config) if connection: print("Connected to Oracle database") # Create a cursor object to interact with the database cursor = connection.cursor() # Execute a SELECT statement select_query = "SELECT * FROM PS_S_PRD_STU_TT_VW WHERE STRM='2301' AND ACAD_LEVEL_BOT='S9'" cursor.execute(select_query) # Fetch all rows rows = cursor.fetchall() # Display the fetched rows dynamic_array = [] mysqlcursor = mysqlconnection.cursor() for row in rows: # insert_query = "INSERT INTO uat_student_details (system_id,rollno,school_code,school_name) VALUES ('"+row[0]+"','"+row[2]+"','"+row[4]+"','"+row[5]+"')" #data_to_insert = (row[0]) # Replace with your actual data #mysqlcursor.execute(insert_query) #mysqlconnection.commit() #mysqlcursor.commit() print(row) sendemail(len(rows)) #('2019574698', 'SHUNV', '00071779', '190958043', 'SUSOL', 'School of Law', 'ULAW', 'LAW', '00202', 'BBA + LLB (Hons) Integrated', '0020200001', 'BBA LLB Integrated', 'Shishodia', 'Nishant', ' ', '2019574698.nishant@ug.sharda.ac.in', '9058032589', 'AC', 'Active in Program', 'MATR', 'Matriculation', '1901', '2301', datetime.datetime(2019, 8, 13, 0, 0), datetime.datetime(2001, 8, 4, 0, 0), 'M', 'Vinay Kumar Singh', '2019574698.vinay@pt.sharda.ac.in', '7455993354', 'Kalakhuri,Khurja,H No. 120, Bulandshahr KHURJA,UP,IND,203131', '203131', 'Bulandshahr', 'UP', 'IND', 'Hindu', 'GEN', 'S9', 'SOL0101') except cx_Oracle.Error as e: print("Error:", e) finally: # Close the cursor and connection if cursor: cursor.close() elif mysqlcursor: mysqlcursor.close() if connection: connection.close() print("Connection closed") elif mysqlconnection: mysqlconnection.close() print("mysqlconnection closed")