in geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/smtp/SMTPConnection.java [584:636]
public SendStatus sendRcptTo(InternetAddress addr, String dsn) throws MessagingException {
// compose the command using the fixed up email address. Normally, this
// involves adding
// "<" and ">" around the address.
StringBuffer command = new StringBuffer();
// compose the first part of the command
command.append("RCPT TO: ");
command.append(fixEmailAddress(addr.getAddress()));
// if we have DSN information, append it to the command.
if (dsn != null) {
command.append(" NOTIFY=");
command.append(dsn);
}
// get a string version of this command.
String commandString = command.toString();
SMTPReply line = sendCommand(commandString);
switch (line.getCode()) {
// these two are both successful transmissions
case SMTPReply.COMMAND_ACCEPTED:
case SMTPReply.ADDRESS_NOT_LOCAL:
// we get out of here with the status information.
return new SendStatus(SendStatus.SUCCESS, addr, commandString, line);
// these are considered invalid address errors
case SMTPReply.PARAMETER_SYNTAX_ERROR:
case SMTPReply.INVALID_COMMAND_SEQUENCE:
case SMTPReply.MAILBOX_NOT_FOUND:
case SMTPReply.INVALID_MAILBOX:
case SMTPReply.USER_NOT_LOCAL:
// we get out of here with the status information.
return new SendStatus(SendStatus.INVALID_ADDRESS, addr, commandString, line);
// the command was valid, but something went wrong in the server.
case SMTPReply.SERVICE_NOT_AVAILABLE:
case SMTPReply.MAILBOX_BUSY:
case SMTPReply.PROCESSING_ERROR:
case SMTPReply.INSUFFICIENT_STORAGE:
case SMTPReply.MAILBOX_FULL:
// we get out of here with the status information.
return new SendStatus(SendStatus.SEND_FAILURE, addr, commandString, line);
// everything else is considered really bad...
default:
// we get out of here with the status information.
return new SendStatus(SendStatus.GENERAL_ERROR, addr, commandString, line);
}
}