Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion about Envelope.add_attachment #35

Open
Freakwill opened this issue May 1, 2018 · 1 comment
Open

suggestion about Envelope.add_attachment #35

Freakwill opened this issue May 1, 2018 · 1 comment

Comments

@Freakwill
Copy link

  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)
@Freakwill
Copy link
Author

any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant