.append(": did not start and end with < >");
getLogger().error(errorBuffer.toString());
}
return;
}
MailAddress recipientAddress = null;
//Remove < and >
recipient = recipient.substring(1, recipient.length() - 1);
if (recipient.indexOf("@") < 0) {
recipient = recipient + "@localhost";
}
try {
recipientAddress = new MailAddress(recipient);
} catch (Exception pe) {
responseString = "501 Syntax error in recipient address";
writeLoggedFlushedResponse(responseString);
if (getLogger().isErrorEnabled()) {
StringBuffer errorBuffer =
new StringBuffer(192)
.append("Error parsing recipient address: ")
.append(recipient)
.append(": ")
.append(pe.getMessage());
getLogger().error(errorBuffer.toString());
}
return;
}
if (theConfigData.isAuthRequired()) {
// Make sure the mail is being sent locally if not
// authenticated else reject.
if (getUser() == null) {
String toDomain = recipientAddress.getHost();
if (!theConfigData.getMailServer().isLocalServer(toDomain)) {
responseString = "530 Authentication Required";
writeLoggedFlushedResponse(responseString);
getLogger().error("Rejected message - authentication is required for mail request");
return;
}
} else {
// Identity verification checking
if (theConfigData.isVerifyIdentity()) {
String authUser = (getUser()).toLowerCase(Locale.US);
MailAddress senderAddress = (MailAddress) state.get(SENDER);
boolean domainExists = false;
if ((!authUser.equals(senderAddress.getUser())) ||
(!theConfigData.getMailServer().isLocalServer(senderAddress.getHost()))) {
responseString = "503 Incorrect Authentication for Specified Email Address";
writeLoggedFlushedResponse(responseString);
if (getLogger().isErrorEnabled()) {
StringBuffer errorBuffer =
new StringBuffer(128)