-
Notifications
You must be signed in to change notification settings - Fork 0
/
email_transfer.py
45 lines (36 loc) · 1.62 KB
/
email_transfer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from tecs_log import tecsLog as tecs_logger
class email_trans:
def __init__(self, mail,emailcounter,emailM,emailType):
'''
returns the number of emails in the selected mailbox
'''
emailC=mail.select("Inbox")
tecs_logger (">>>transferring email...")
tecs_logger( mail.select("Inbox"))
'''
Determines which folder the email should be transferred to
'''
if emailType=="AddTicket":
try:
tecs_logger( mail.copy(str(emailcounter),'NewTicket'))
except:
tecs_logger (">>>Could not transfer email")
else:
tecs_logger (">>>email successfully transferred to NewTicket folder")
elif emailType=="UpdateTicket":
try:
tecs_logger (mail.copy(str(emailcounter),'UpdateTicket'))
except:
tecs_logger (">>>Could not transfer email")
else:
tecs_logger (">>>email successfully transferred to UpdateTicket folder")
elif emailType=="None":
try:
tecs_logger (mail.copy(str(emailcounter),'NoAction'))
except:
tecs_logger (">>>Could not transfer email")
else:
tecs_logger (">>>email successfully transferred to NoAction folder")
'removes deleted email in processing folder'
tecs_logger (mail.store(str(emailcounter),'+FLAGS',r'(\Deleted)'))
tecs_logger (mail.expunge())