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

Documentation for logging and error checking is amiss #79

Open
metaperl opened this issue Jan 25, 2018 · 2 comments
Open

Documentation for logging and error checking is amiss #79

metaperl opened this issue Jan 25, 2018 · 2 comments
Labels
3.question Additional information is requested. area:core Relating to a core aspect of the library such as configuration and initialization. need:documentation Improvements or additions to documentation are required. org:good-first-issue Good for newcomers to the project to tackle.

Comments

@metaperl
Copy link

hello,

The documentation for this library does not show any way to enable logging.

Currently, email is not being delivered and I have no idea why - the ability to enable logging would be of great use.

Also the docs do not indicate the return value of methods, so I have no idea how to see if each method call is working.

My usage of this module is very minimal. All of it is shown here

@sh4d0v1
Copy link

sh4d0v1 commented Sep 5, 2019

Documentation about the return value especially of the send() function would be very nice.

Of course the function can't return if the mail successfully arrived at the recipients mailbox, but it could tell if the mail was handed to the SMTP server successfully.

@amcgregor
Copy link
Member

Official documentation, as logging is universal Python functionality, not custom or specific to this package.

The return value of send() calls will depend on the context in which you are invoking that method and the particular configuration you are utilizing:

  • The ImmediateManager will bubble back up the transport's deliver() return value.

  • Futures-based managers (e.g. FuturesManager or DynamicManager) return the Future receipt instance for the background scheduled task. To perform some action upon completion (e.g. verify or validate delivery), register a "done callback". Official Python documentation.

  • The SMTP transport has no return value for its deliver call. Instead, it utilizes exceptions to notify of exceptional statuses. (One of: MessageFailedException with reason string argument also logged at the error or warning levels, or TransportFailedException logged at the warning level.) When using a Futures-based background manager, always remember to define a done callback that, at a minimum, requests the future.result() to permit the exception to actually explode, otherwise background execution will eat all exceptions.

  • Other transports similarly return nothing (e.g. Amazon SES, Sendmail Popen, SendGrid, MBox, Mailgun, …) excluding MockTransport which returns True or False (mocked success or failure). They all use exceptions to notify of exceptional issues, e.g. the Mailgun transport may bubble a Requests exception due to the raise_for_status call.

  • The base Mailer interface (the typical entry point for configuration and use) does return whatever is returned by the manager. Similarly, the Message.send helper method also returns the result of the send call on the bound Mailer instance.

@amcgregor amcgregor added need:documentation Improvements or additions to documentation are required. 3.question Additional information is requested. area:core Relating to a core aspect of the library such as configuration and initialization. org:good-first-issue Good for newcomers to the project to tackle. labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.question Additional information is requested. area:core Relating to a core aspect of the library such as configuration and initialization. need:documentation Improvements or additions to documentation are required. org:good-first-issue Good for newcomers to the project to tackle.
Projects
None yet
Development

No branches or pull requests

3 participants