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

[Feature Request] Retry after certain exception #40

Open
Lee-W opened this issue Oct 12, 2021 · 0 comments
Open

[Feature Request] Retry after certain exception #40

Lee-W opened this issue Oct 12, 2021 · 0 comments

Comments

@Lee-W
Copy link
Member

Lee-W commented Oct 12, 2021

Description

Sometimes mail service might block us from doing so much sent. Thus, if mail_handler can retry after this kind of exception would be really handle

Possible Solution

  1. catch certain types of exception
  2. sleep for a short period
  3. recover from the previous status

Additional context

Traceback (most recent call last):
  File ".../.local/bin/send_mail", line 8, in <module>
    sys.exit(main())
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/mail_handler/send_mail.py", line 168, in main
    send_mail(mail, user, password)
  File ".../.local/pipx/venvs/pycontw-mail-handler/lib/python3.8/site-packages/mail_handler/send_mail.py", line 92, in send_mail
    server.login(user, password)
  File ".../.pyenv/versions/3.8.5/lib/python3.8/smtplib.py", line 723, in login
    (code, resp) = self.auth(
  File ".../.pyenv/versions/3.8.5/lib/python3.8/smtplib.py", line 635, in auth
    (code, resp) = self.docmd("AUTH", mechanism + " " + response)
  File ".../.pyenv/versions/3.8.5/lib/python3.8/smtplib.py", line 425, in docmd
    return self.getreply()
  File ".../.pyenv/versions/3.8.5/lib/python3.8/smtplib.py", line 398, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

Related Issue

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