-
Notifications
You must be signed in to change notification settings - Fork 345
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
Mail Results - Disable Plugin #6001
Conversation
cff205c
to
af8605c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @harvey0100 ,
Thanks for this. It seems to do what's needed, but as you can see in the inline comment, it looks like there's some duplication of similar code.
Please let me know if I'm missing something.
Thanks again!
@@ -160,6 +160,10 @@ def _send_email(smtp, sender, rcpt, msg): | |||
|
|||
@staticmethod | |||
def _smtp_login_and_send(job, msg): | |||
if not job.config.get("plugins.mail.server"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why only plugins.mail.server
is checked here? AFAICT, all of the configuration (server, port, sender, password) will be needed, right?
If that's the case, a check such as:
server, port, sender, password = Mail._get_smtp_config(job)
if not all([server, port, sender, password]):
...
That suggestion of mine looks a lot _validate_email_config()
so it seems like it could be refactored a bit and used here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Cleber, thanks for the feedback i've implemented the validate email config inside of login_and_send to refactor now. Looks like it is all working as intended :)
af8605c
to
12e255e
Compare
Plugin was attemtping SMTP connections regardless of if the plugin config was using defaults. Now checks on pre/post checks to stop attempted SMTP connections before the plugin was disabled. Signed-off-by: Harvey Lynden <[email protected]>
12e255e
to
4450fd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Plugin was attempting SMTP connections regardless
of if the plugin config was using defaults.
Now checks on pre/post checks to stop attempted
SMTP connections before the plugin was disabled.