Skip to content

suggestion about Envelope.add_attachment #35

Description

@Freakwill
  1. Envelope.add_attachment could accept pathlib.Path object
  2. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions