AIEmailAutomationUtility 0.0.16__py3-none-any.whl → 0.0.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,8 +92,8 @@ class Email_Read:
92
92
  fileName = ""
93
93
 
94
94
  Model_Name = email_config.get('model_type', 'OpenAI')
95
- reciever_email_addr = email_config.get('email', '')
96
- receiver_email_pwd = email_config.get('password', '')
95
+ reciever_email_addr = email_config.get('email', '').replace("\xa0", "").strip()
96
+ receiver_email_pwd = email_config.get('password', '').replace("\xa0", "").strip()
97
97
  host = email_config.get('host', '')
98
98
  port = email_config.get('port', '')
99
99
 
@@ -5,5 +5,4 @@ from .Email_DocumentUploader import Email_DocumentUploader
5
5
  from .EmailReplyAssistant import EmailReplyAssistant
6
6
  from .Save_Transaction import Save_Transaction
7
7
  from .Email_Upload_Document import Email_Upload_Document
8
- from .Save_Draft import Save_Draft
9
8
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AIEmailAutomationUtility
3
- Version: 0.0.16
4
- Summary: Create 2 different methods in read_email for different client
3
+ Version: 0.0.18
4
+ Summary: Solve the issue of ascii codec can not encode character
5
5
  Author: Proteus Technology PVT. LTD.
6
6
  Author-email: <apps@baseinformation.com>
7
7
  Keywords: python,first package
@@ -13,4 +13,4 @@ Classifier: Operating System :: MacOS :: MacOS X
13
13
  Classifier: Operating System :: Microsoft :: Windows
14
14
  License-File: LICENCE.txt
15
15
 
16
- Create 2 different methods in read_email for different client
16
+ Solve the issue of ascii codec can not encode character
@@ -2,13 +2,12 @@ AIEmailAutomationUtility/EmailReplyAssistant.py,sha256=AK2I1j2wa6NvR9ysKgtQsm-wk
2
2
  AIEmailAutomationUtility/Email_Classification.py,sha256=eL52Td50zo7V0QTIqjN4Khhg-5HKvf2RUITIcKz5yZ0,9343
3
3
  AIEmailAutomationUtility/Email_DocumentUploader.py,sha256=ImTmMz_JeU6Xynt9kyu7lFv7vqrxzqAtBF-A7014fYc,3055
4
4
  AIEmailAutomationUtility/Email_Draft.py,sha256=BfseewnnlwNl1moodq3kZiUPXDUE9a_nQjuFQsUp3fY,5244
5
- AIEmailAutomationUtility/Email_Read.py,sha256=Wc8HzZfMkDZ6XjjfNOibrI6r5XsytPEoA1ilw4DPRuA,20792
5
+ AIEmailAutomationUtility/Email_Read.py,sha256=syha5CaAHXPyxuiFTlUmo3zG1pby3m8Yqkt7c20AFqk,20844
6
6
  AIEmailAutomationUtility/Email_Upload_Document.py,sha256=3bdkxfDlwoeRp-46KPw2Gs1dqBhEIoA1yE5GCudpdV8,1320
7
- AIEmailAutomationUtility/Save_Draft.py,sha256=yzLgFN14I_lXE6qL0I3tKNduvcnWdbsY9i2mKdTtio4,5348
8
7
  AIEmailAutomationUtility/Save_Transaction.py,sha256=Gg1w6hhzHmEFjsuzYvkq-3-EsWReetjLHsYSv5YIGgM,3816
9
- AIEmailAutomationUtility/__init__.py,sha256=bB7N-qQD85RdMaXHg_ZU5oPtHtx9zgeG6-ue4rhcfYI,379
10
- AIEmailAutomationUtility-0.0.16.dist-info/LICENCE.txt,sha256=2qX9IkEUBx0VJp1Vh9O2dsRwE-IpYId0lXDyn7OVsJ8,1073
11
- AIEmailAutomationUtility-0.0.16.dist-info/METADATA,sha256=4p5Eaucq_pKYg3VL8qnnFREj2ewka2BgFYz6cuSUUXI,623
12
- AIEmailAutomationUtility-0.0.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- AIEmailAutomationUtility-0.0.16.dist-info/top_level.txt,sha256=3jTWrTUblVkaP7mpwY2UBSnrlfot5Ykpfsehyke-Uzw,25
14
- AIEmailAutomationUtility-0.0.16.dist-info/RECORD,,
8
+ AIEmailAutomationUtility/__init__.py,sha256=UzDkFSvLwwc0NLnvMiM0jNV5pIWUlM9p2zvpcrh9rkM,344
9
+ AIEmailAutomationUtility-0.0.18.dist-info/LICENCE.txt,sha256=2qX9IkEUBx0VJp1Vh9O2dsRwE-IpYId0lXDyn7OVsJ8,1073
10
+ AIEmailAutomationUtility-0.0.18.dist-info/METADATA,sha256=MHLf-mZpAhkQcXWChPXo6dsern0qE2JD2GAmz1OdhAM,611
11
+ AIEmailAutomationUtility-0.0.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
12
+ AIEmailAutomationUtility-0.0.18.dist-info/top_level.txt,sha256=3jTWrTUblVkaP7mpwY2UBSnrlfot5Ykpfsehyke-Uzw,25
13
+ AIEmailAutomationUtility-0.0.18.dist-info/RECORD,,
@@ -1,137 +0,0 @@
1
- import cx_Oracle
2
- from DatabaseConnectionUtility import Oracle
3
- from DatabaseConnectionUtility import Dremio
4
- from DatabaseConnectionUtility import InMemory
5
- from DatabaseConnectionUtility import Oracle
6
- from DatabaseConnectionUtility import MySql
7
- from DatabaseConnectionUtility import MSSQLServer
8
- from DatabaseConnectionUtility import SAPHANA
9
- from DatabaseConnectionUtility import Postgress
10
- import loggerutility as logger
11
- import commonutility as common
12
- import traceback
13
- import imaplib
14
- from email.message import Message
15
- import datetime
16
- import time
17
-
18
- class Save_Draft:
19
-
20
- connection = None
21
-
22
- def get_database_connection(self, dbDetails):
23
- if dbDetails['DB_VENDORE'] != None:
24
- klass = globals()[dbDetails['DB_VENDORE']]
25
- dbObject = klass()
26
- connection_obj = dbObject.getConnection(dbDetails)
27
- return connection_obj
28
-
29
- def commit(self):
30
- if self.connection:
31
- try:
32
- self.connection.commit()
33
- print("Transaction committed successfully.")
34
- except cx_Oracle.Error as error:
35
- print(f"Error during commit: {error}")
36
- else:
37
- print("No active connection to commit.")
38
-
39
- def rollback(self):
40
- if self.connection:
41
- try:
42
- self.connection.rollback()
43
- print("Transaction rolled back successfully.")
44
- except cx_Oracle.Error as error:
45
- print(f"Error during rollback: {error}")
46
- else:
47
- print("No active connection to rollback.")
48
-
49
- def close_connection(self):
50
- if self.connection:
51
- try:
52
- self.connection.close()
53
- print("Connection closed successfully.")
54
- except cx_Oracle.Error as error:
55
- print(f"Error during close: {error}")
56
- else:
57
- print("No active connection to close.")
58
-
59
- def draft_Email(self, reciever_email_addr, receiver_email_pwd, host_name, sender_email_addr, cc_email_addr, subject, email_body):
60
- try:
61
- mail_details = ""
62
- with imaplib.IMAP4_SSL(host=host_name, port=imaplib.IMAP4_SSL_PORT) as imap_ssl:
63
- resp_code, response = imap_ssl.login(reciever_email_addr, receiver_email_pwd)
64
- message = Message()
65
- message["From"] = reciever_email_addr
66
- message["To"] = sender_email_addr
67
- message["CC"] = cc_email_addr
68
-
69
- if subject.startswith("Re:"):
70
- message["Subject"] = f"{subject} "
71
- else:
72
- message["Subject"] = f"Re: {subject} "
73
-
74
- mail_details = f'{datetime.datetime.now().strftime("On %a, %b %d, %Y at %I:%M %p")} {sender_email_addr} wrote:'
75
- message.set_payload(f"{email_body}\n\n{mail_details}")
76
- utf8_message = str(message).encode("utf-8")
77
-
78
- imap_ssl.append("[Gmail]/Drafts", '', imaplib.Time2Internaldate(time.time()), utf8_message)
79
- print("Draft Mail saved successfully.")
80
-
81
- return "Success"
82
-
83
- except Exception as error:
84
- print(f"Error ::: {error}")
85
- return "Fail"
86
-
87
- def check_drafts(self, dbDetails, email_info):
88
-
89
- while True:
90
-
91
- self.connection = self.get_database_connection(dbDetails)
92
-
93
- if self.connection:
94
- try:
95
-
96
- cursor = self.connection.cursor()
97
- queryy = f"SELECT * FROM DRAFT_EMAIL_INFO WHERE STATUS = 'Pending'"
98
- cursor.execute(queryy)
99
- pending_records = cursor.fetchall()
100
- cursor.close()
101
-
102
- for data in pending_records:
103
- # print(f"data ::: {data}")
104
- response = self.draft_Email(email_info['email'], email_info['password'], email_info['host'], data[0], data[1], data[2], data[3].read())
105
- if response == 'Success':
106
- cursor = self.connection.cursor()
107
- update_query = """
108
- UPDATE DRAFT_EMAIL_INFO SET
109
- STATUS = :status
110
- WHERE TRIM(TO_EMAIL) = TRIM(:to_email)
111
- AND TRIM(SUBJECT) = TRIM(:subject)
112
- """
113
- values = {
114
- 'status': 'Done',
115
- 'to_email': data[0],
116
- 'subject': data[2]
117
- }
118
- cursor.execute(update_query, values)
119
- print(f"Successfully updated row.")
120
- cursor.close()
121
-
122
- self.commit()
123
-
124
- except Exception as e:
125
- print(f"Rollback due to error: {e}")
126
-
127
- finally:
128
- print('Closed connection successfully.')
129
- self.close_connection()
130
- else:
131
- print(f'\n In getInvokeIntent exception stacktrace : ', "1")
132
- descr = str("Connection fail")
133
- print(f'\n Exception ::: {descr}', "0")
134
-
135
- time.sleep(10)
136
-
137
-