-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
- Envelope.add_attachment could accept pathlib.Path object
- if the path is a folder, then compress it and send the compressed file.
Following is a part of my command line tool
path = args.pathname
if path:
if path.is_dir():
# compress the folder before submitting
# compressed file is named by subject
compath = path.parent / (args.subject+".7z")
subprocess.run(["7z", "a", "-t7z", compath, path])
envelope.add_attachment(str(compath))
elif path.is_file():
envelope.add_attachment(str(path))
envelope.send(...)
print('The email is sent to ...')
if path.is_dir(): # delete the compressed file finally
os.remove(compath)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels