Give immediate feedback on unknown recipient
This commit is contained in:
parent
85c9dfb42e
commit
909c4af4e9
@ -60,7 +60,6 @@ public class DMTPConnection implements Runnable {
|
|||||||
out.println("ok");
|
out.println("ok");
|
||||||
} catch (UnknownRecipientException e) {
|
} catch (UnknownRecipientException e) {
|
||||||
out.println(e.getMessage());
|
out.println(e.getMessage());
|
||||||
shutdown();
|
|
||||||
}
|
}
|
||||||
} else if ("to".equals(userInput.split("\\s+")[0])) {
|
} else if ("to".equals(userInput.split("\\s+")[0])) {
|
||||||
msg.setTo(new ArrayList<>());
|
msg.setTo(new ArrayList<>());
|
||||||
@ -68,12 +67,17 @@ public class DMTPConnection implements Runnable {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
try {
|
try {
|
||||||
for (String emailAddress : emailAddresses) {
|
for (String emailAddress : emailAddresses) {
|
||||||
msg.addTo(new Email(emailAddress));
|
Email add = new Email(emailAddress);
|
||||||
count++;
|
if (!this.messageStorage.containsKey(add)) {
|
||||||
|
throw new UnknownRecipientException("error unknown recipient " + add.toString());
|
||||||
|
} else {
|
||||||
|
msg.addTo(add);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out.println("ok " + count);
|
out.println("ok " + count);
|
||||||
} catch (MalformedInputException mie) {
|
} catch (MalformedInputException | UnknownRecipientException e) {
|
||||||
out.println(mie.getMessage());
|
out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
} else if ("from".equals(userInput.split("\\s+")[0])) {
|
} else if ("from".equals(userInput.split("\\s+")[0])) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user