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

ENH: Connection failures should not be misleading and say "please run connect() first" #63

Open
metaperl opened this issue Dec 14, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@metaperl
Copy link

Is your feature request related to a problem? Please describe.
When the connection fails, one receives the misleading exception: "please run connect() first" which is coming from red-mail calling smtplib.

Describe the solution you'd like
Provide an accurate and descriptive feedback that connection failed.

We ran the simplest red-mail script possible:

from redmail import EmailSender
from smtplib import SMTP

email = EmailSender(
    host="false-host",
    port=25
)

and got a totally misleading error message: "please run connect() first" instead of being told the connection failed.

Once we switched host to localhost the script ran fine.

@metaperl
Copy link
Author

A little more detail on this: this cryptic error message only occurs in our work environment where there are proxies that block access to certain domains.

At home, I get a descriptive error message for the following program:

from redmail import EmailSender

email = EmailSender(
    host='fakedomain.livingcosmos.org',
    port=25
)


def main():
    email.send(
        subject='email subject',
        sender="[email protected]",
        receivers=['[email protected]'],
        text="Hi, this is an email."
    )


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    main()

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

No branches or pull requests

1 participant