Methods Summary |
---|
protected int | getAttachmentType()
return getTypeCode(getInitParameter("attachment","message"));
|
protected int | getInLineType()
return getTypeCode(getInitParameter("inline","none"));
|
protected java.lang.String | getMessage()
return getInitParameter("notice",
getInitParameter("message",
"We were unable to deliver the attached message because of an error in the mail server."));
|
protected java.lang.String | getMessage(org.apache.mailet.Mail originalMail)
MimeMessage message = originalMail.getMessage();
StringWriter sout = new StringWriter();
PrintWriter out = new PrintWriter(sout, true);
// First add the "local" notice
// (either from conf or generic error message)
out.println(getMessage());
// And then the message from other mailets
if (originalMail.getErrorMessage() != null) {
out.println();
out.println("Error message below:");
out.println(originalMail.getErrorMessage());
}
out.println();
out.println("Message details:");
if (message.getSubject() != null) {
out.println(" Subject: " + message.getSubject());
}
if (message.getSentDate() != null) {
out.println(" Sent date: " + message.getSentDate());
}
out.println(" MAIL FROM: " + originalMail.getSender());
Iterator rcptTo = originalMail.getRecipients().iterator();
out.println(" RCPT TO: " + rcptTo.next());
while (rcptTo.hasNext()) {
out.println(" " + rcptTo.next());
}
String[] addresses = null;
addresses = message.getHeader(RFC2822Headers.FROM);
if (addresses != null) {
out.print(" From: ");
for (int i = 0; i < addresses.length; i++) {
out.print(addresses[i] + " ");
}
out.println();
}
addresses = message.getHeader(RFC2822Headers.TO);
if (addresses != null) {
out.print(" To: ");
for (int i = 0; i < addresses.length; i++) {
out.print(addresses[i] + " ");
}
out.println();
}
addresses = message.getHeader(RFC2822Headers.CC);
if (addresses != null) {
out.print(" CC: ");
for (int i = 0; i < addresses.length; i++) {
out.print(addresses[i] + " ");
}
out.println();
}
out.println(" Size (in bytes): " + message.getSize());
if (message.getLineCount() >= 0) {
out.println(" Number of lines: " + message.getLineCount());
}
return sout.toString();
|
protected boolean | getPassThrough()
return new Boolean(getInitParameter("passThrough","true")).booleanValue();
|
protected abstract java.util.Collection | getRecipients()
|
protected org.apache.mailet.MailAddress | getReplyTo()
return SpecialAddress.NULL;
|
protected org.apache.mailet.MailAddress | getReversePath(org.apache.mailet.Mail originalMail)
return getSender(originalMail);
|
protected org.apache.mailet.MailAddress | getSender()
String addressString = getInitParameter("sendingAddress",getInitParameter("sender"));
if (addressString == null) {
return getMailetContext().getPostmaster();
}
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {"postmaster", "sender", "unaltered"});
if (specialAddress != null) {
return specialAddress;
}
try {
return new MailAddress(addressString);
} catch(Exception e) {
throw new MessagingException("Exception thrown in getSender() parsing: " + addressString, e);
}
|
protected java.lang.String | getSubject()
return null;
|
protected java.lang.String | getSubjectPrefix()
return getInitParameter("prefix","Re:");
|
protected javax.mail.internet.InternetAddress[] | getTo()
return null;
|
protected boolean | isReply()
return true;
|
protected void | setSubjectPrefix(org.apache.mailet.Mail newMail, java.lang.String subjectPrefix, org.apache.mailet.Mail originalMail)Builds the subject of newMail appending the subject
of originalMail to subjectPrefix, but avoiding a duplicate.
String subject = originalMail.getMessage().getSubject();
if (subject == null) {
subject = "";
}
if (subjectPrefix==null || subject.indexOf(subjectPrefix) == 0) {
newMail.getMessage().setSubject(subject);
} else {
newMail.getMessage().setSubject(subjectPrefix + subject);
}
|