Refactored csv_to_email.py and added basic logging - much more work needed
This commit is contained in:
@@ -110,7 +110,8 @@ def process_attachments(mailbox, attachment_path, saved_hashes):
|
||||
f"{file_ext}"
|
||||
)
|
||||
|
||||
with tempfile.NamedTemporaryFile(delete=False, dir="temp") as temp_file:
|
||||
with tempfile.NamedTemporaryFile(
|
||||
delete=False, dir="temp") as temp_file:
|
||||
temp_file.write(att.payload)
|
||||
temp_path = temp_file.name
|
||||
final_path = os.path.join(attachment_path, final_name)
|
||||
@@ -140,8 +141,11 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
attachment_path = join(dirname(__file__), "attachments")
|
||||
temp_path = join(dirname(__file__), "temp")
|
||||
if not os.path.exists(attachment_path):
|
||||
os.makedirs(attachment_path)
|
||||
if not os.path.exists(temp_path):
|
||||
os.makedirs(temp_path)
|
||||
|
||||
ssl_context = setup_ssl_context()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user