.append(": did not start and end with < >");
session.getLogger().info(errorBuffer.toString());
}
return SYNTAX_ERROR;
}
MailAddress senderAddress = null;
if (session.getConfiguration().useAddressBracketsEnforcement()
|| (sender.startsWith("<") && sender.endsWith(">"))) {
// Remove < and >
sender = sender.substring(1, sender.length() - 1);
}
if (sender.length() == 0) {
// This is the <> case. Let senderAddress == null
} else {
if (sender.indexOf("@") < 0) {
sender = sender
+ "@"
+ getDefaultDomain();
}
try {
senderAddress = new MailAddress(sender);
} catch (Exception pe) {
if (session.getLogger().isInfoEnabled()) {
StringBuilder errorBuffer = new StringBuilder(256)
.append("Error parsing sender address: ")
.append(sender).append(": ").append(
pe.getMessage());
session.getLogger().info(errorBuffer.toString());
}
return SYNTAX_ERROR_ADDRESS;
}
}
if ((senderAddress == null) ||
((senderAddress.getLocalPart().length() == 0) && (senderAddress.getDomain().length() == 0))) {
senderAddress = MailAddress.nullSender();
}
// Store the senderAddress in session map
session.setAttachment(SMTPSession.SENDER, senderAddress, State.Transaction);
}