Show a proper error when email password is not specified
Fixes elastic/elasticsearch#232 Original commit: elastic/x-pack-elasticsearch@2c0ab575d0
This commit is contained in:
parent
f54c610c29
commit
175423b984
|
@ -75,7 +75,7 @@ public class Account {
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
profile = config.profile;
|
profile = config.profile;
|
||||||
}
|
}
|
||||||
transport.connect(config.smtp.host, config.smtp.port, user, new String(password));
|
transport.connect(config.smtp.host, config.smtp.port, user, password != null ? new String(password) : null);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
MimeMessage message = profile.toMimeMessage(email, session);
|
MimeMessage message = profile.toMimeMessage(email, session);
|
||||||
|
@ -88,14 +88,12 @@ public class Account {
|
||||||
}
|
}
|
||||||
transport.sendMessage(message, message.getAllRecipients());
|
transport.sendMessage(message, message.getAllRecipients());
|
||||||
} finally {
|
} finally {
|
||||||
if (transport != null) {
|
|
||||||
try {
|
try {
|
||||||
transport.close();
|
transport.close();
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
logger.error("failed to close email transport for account [" + config.name + "]");
|
logger.error("failed to close email transport for account [" + config.name + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue