|
|
|
@ -9,7 +9,6 @@ import random
|
|
|
|
|
import smtplib
|
|
|
|
|
import string
|
|
|
|
|
|
|
|
|
|
import barcode
|
|
|
|
|
import imapclient
|
|
|
|
|
|
|
|
|
|
from bureau import Bureau, add_command, add_api
|
|
|
|
@ -58,10 +57,13 @@ class MailRoom(Bureau):
|
|
|
|
|
self.imapserv.select_folder("INBOX")
|
|
|
|
|
else:
|
|
|
|
|
print("you need to configure an IMAP account!")
|
|
|
|
|
print("add a [user] section to PO.ini with:")
|
|
|
|
|
print(" login = mylogin")
|
|
|
|
|
print(" password = mypassword")
|
|
|
|
|
print(" host = my.imap.server.address.com")
|
|
|
|
|
print("add a user: section to PO.yml with:")
|
|
|
|
|
print(" login: mylogin")
|
|
|
|
|
print(" password: mypassword")
|
|
|
|
|
print(" host: my.imap.server.address.com")
|
|
|
|
|
print(" spamfolder: Junk")
|
|
|
|
|
print(" trashfolder: Trash")
|
|
|
|
|
print(" ssl: True")
|
|
|
|
|
|
|
|
|
|
# setup db's for mapping short codes to IMAP msg ids (and reversed)
|
|
|
|
|
self.postdb = self.dbenv.open_db(b"postdb")
|
|
|
|
@ -313,9 +315,9 @@ class MailRoom(Bureau):
|
|
|
|
|
msg.subject = clean_header(envelope.subject.decode("utf-8"))
|
|
|
|
|
|
|
|
|
|
# make action barcodes
|
|
|
|
|
msg.d_bc = str(barcode.get("code128", "POd." + shortcode).raw)
|
|
|
|
|
msg.sp_bc = str(barcode.get("code128", "POsp." + shortcode).raw)
|
|
|
|
|
msg.r_bc = str(barcode.get("code128", "POr." + shortcode).raw)
|
|
|
|
|
msg.d_bc = self.bc_svg("POd." + shortcode)
|
|
|
|
|
msg.sp_bc = self.bc_svg("POsp." + shortcode)
|
|
|
|
|
msg.r_bc = self.bc_svg("POr." + shortcode)
|
|
|
|
|
|
|
|
|
|
msgs.append(msg.__dict__)
|
|
|
|
|
|
|
|
|
|