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

Add additional accounts #166

Merged
merged 9 commits into from
Mar 23, 2018
Merged

Conversation

Kosterio
Copy link
Contributor

Added ability of additional smtp accounts and java mail parameters

Copy link
Contributor

@davidvanlaatum davidvanlaatum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change whitespace it makes it very hard to review.

Copy link
Contributor

@davidvanlaatum davidvanlaatum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No migration of existing settings

smtpAuthUsername = nullify(req.getParameter("ext_mailer_smtp_username"));
smtpAuthPassword = Secret.fromString(nullify(req.getParameter("ext_mailer_smtp_password")));
mailAccount.setSmtp_username(nullify(req.getParameter("ext_mailer_smtp_username")));
mailAccount.setSmtp_password(nullify(req.getParameter("ext_mailer_smtp_password")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the loss of Secret.fromString

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it makes inside of class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is by design and is required to store the password encrypted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry missed it in the subclass

this.smtpAuthPassword = Secret.fromString(Mailer.descriptor().getSmtpAuthPassword());
this.smtpAuthUsername = Mailer.descriptor().getSmtpAuthUserName();
mailAccount.setSmtp_username(Mailer.descriptor().getSmtpAuthUserName());
mailAccount.setSmtp_password(Mailer.descriptor().getSmtpAuthPassword());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again

@davidvanlaatum davidvanlaatum self-assigned this Feb 15, 2018
return address;
}

public String getSmtp_host(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should really be getSmtpHost ie camelCase not a mix of camelCase and snake_case

Copy link
Contributor

@davidvanlaatum davidvanlaatum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking better, now I just need to give it a go ;)

Copy link
Contributor

@davidvanlaatum davidvanlaatum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to specify the from address in a freestyle job atm which people will find confusing.
I also wonder if it would actually be better to configure the account not the from address which would allow overriding the from address

@davidvanlaatum
Copy link
Contributor

also noticed there is no Use SMTP Authentication checkbox for additional accounts.

@davidvanlaatum
Copy link
Contributor

can't believe I missed this before but also need to add some unit tests

@Kosterio
Copy link
Contributor Author

sorry for rebase

@davidvanlaatum
Copy link
Contributor

I'd like to see a test for create session if possible to assert that it used the right account, probably easiest to call it and then inspect the javamail properties on the returned session to see which server it used

@davidvanlaatum
Copy link
Contributor

how are we going with this? I am waiting on this for the next release

@Kosterio
Copy link
Contributor Author

Kosterio commented Mar 6, 2018

I don't know how to create mock session and test her. I had no free time to figure it out.

@davidvanlaatum
Copy link
Contributor

You probably don't need to create a mock one I had a look and you should be able to call the function then get the properties off it and check it used the correct one

@davidvanlaatum davidvanlaatum merged commit a645200 into jenkinsci:master Mar 23, 2018
@espoelstra
Copy link

@davidvanlaatum is it possible this broke the setSmtpAuth by overriding the MailAccount that was previously inherited from Mailer with the new one that is included in this PR? Suddenly our Groovy configuration script that was working with a previous version started throwing errors. This is the interface we were configuring through, https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java#L346

@davidvanlaatum
Copy link
Contributor

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

Successfully merging this pull request may close these issues.

3 participants