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) {
|
||||
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 {
|
||||
|
||||
MimeMessage message = profile.toMimeMessage(email, session);
|
||||
|
@ -88,14 +88,12 @@ public class Account {
|
|||
}
|
||||
transport.sendMessage(message, message.getAllRecipients());
|
||||
} finally {
|
||||
if (transport != null) {
|
||||
try {
|
||||
transport.close();
|
||||
} catch (MessagingException me) {
|
||||
logger.error("failed to close email transport for account [" + config.name + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
return email;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue