Details
Description
If username/password is left empty, the app still tries to use them to authenticate against the mail server. Some mailservers are configured to accept anonymous sends from certain IP ranges and won't accept authentication from that range (read: I don't have a user that I'm willing to put credentials visible for, and my build server is allowed to anonymously send messages through our exchange server).
Relatively easy fix, if both the username & password are empty, don't try using them at all. Per the docs for SimpleEmail, authentication won't be used if .setAuthentication isn't called (http://commons.apache.org/email/apidocs/org/apache/commons/mail/Email.html#setAuthentication%28java.lang.String,%20java.lang.String%29)
Activity
Matthew Hildebrand
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | fix.txt [ 53889 ] |
Evgeny Mandrikov
made changes -
| Description |
If username/password is left empty, the app still tries to use them to authenticate against the mail server. Some mailservers are configured to accept anonymous sends from certain IP ranges and won't accept authentication from that range (read: I don't have a user that I'm willing to put credentials visible for, and my build server is allowed to anonymously send messages through our exchange server).
Relatively easy fix, if both the username & password are empty, don't try using them at all. Per the docs for SimpleEmail, authentication won't be used if .setAuthentication isn't called (http://commons.apache.org/email/apidocs/org/apache/commons/mail/Email.html#setAuthentication%28java.lang.String,%20java.lang.String%29) try { email.setHostName(host); email.setSmtpPort(port); ++ if((username != null && username.trim != "") || (password != null && password.trim != "") { -- email.setAuthentication(username, password); ++ email.setAuthentication(username, password); ++ } email.setTLS(withTLS); email.setFrom(from); String[] addrs = StringUtils.split(to, '\n'); for (String addr : addrs) { email.addTo(addr); } email.setSubject(getSubject(project)); email.setMsg(getMessage(project)); email.send(); } catch (EmailException e) { throw new SonarException("Unable to send email", e); } |
If username/password is left empty, the app still tries to use them to authenticate against the mail server. Some mailservers are configured to accept anonymous sends from certain IP ranges and won't accept authentication from that range (read: I don't have a user that I'm willing to put credentials visible for, and my build server is allowed to anonymously send messages through our exchange server).
Relatively easy fix, if both the username & password are empty, don't try using them at all. Per the docs for SimpleEmail, authentication won't be used if .setAuthentication isn't called (http://commons.apache.org/email/apidocs/org/apache/commons/mail/Email.html#setAuthentication%28java.lang.String,%20java.lang.String%29) |
Evgeny Mandrikov
made changes -
| Fix Version/s | EMAIL-0.2 [ 17195 ] |
Evgeny Mandrikov
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Evgeny Mandrikov
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |