Methods Summary |
---|
protected javax.mail.internet.MimeMessage | generateMail(java.lang.String destEmailAddr, java.lang.String destDisplayName, java.lang.String fromEmailAddr, java.lang.String fromDisplayName, java.lang.String emailSubject, java.lang.String emailPlainText)Send mail
MimeMessage message = new MimeMessage(Session.getDefaultInstance(System.getProperties(), null));
InternetAddress[] toAddrs = InternetAddress.parse(destEmailAddr, false);
toAddrs[0].setPersonal(destDisplayName);
InternetAddress from = new InternetAddress(fromEmailAddr);
from.setPersonal(fromDisplayName);
message.setRecipients(Message.RecipientType.TO, toAddrs);
message.setFrom(from);
message.setSubject(emailSubject);
message.setSentDate(new java.util.Date());
MimeMultipart msgbody = new MimeMultipart();
MimeBodyPart html = new MimeBodyPart();
html.setDataHandler(new DataHandler(new MailDataSource(emailPlainText, "text/plain")));
msgbody.addBodyPart(html);
message.setContent(msgbody);
return message;
|
protected org.apache.james.transport.mailets.ICommandListservManager | getCommandListservManager()The list serv manager
return commandListservManager;
|
public java.lang.String | getCommandName()The name of this command
return commandName;
|
protected org.apache.avalon.framework.configuration.Configuration | getConfiguration()
return configuration;
|
protected org.apache.mailet.MailetContext | getMailetContext()The current mailet context
return mailetContext;
|
protected java.util.Properties | getStandardProperties()Use this to get standard properties for future calls to {@link org.apache.james.util.XMLResources}
return commandListservManager.getStandardProperties();
|
protected org.apache.james.services.UsersRepository | getUsersRepository()
return commandListservManager.getUsersRepository();
|
public void | init(org.apache.james.transport.mailets.ICommandListservManager commandListservManager, org.apache.avalon.framework.configuration.Configuration configuration)Perform any required initialization
this.commandListservManager = commandListservManager;
this.configuration = configuration;
commandName = configuration.getAttribute("name");
mailetContext = this.commandListservManager.getMailetConfig().getMailetContext();
log("Initialized listserv command: [" + commandName + ", " + getClass().getName() + "]");
|
protected org.apache.james.util.XMLResources[] | initXMLResources(java.lang.String[] names)
return commandListservManager.initXMLResources(names);
|
protected void | log(java.lang.String message)Writes the specified message to a mailet log file, prepended by
the mailet's name.
StringBuffer logBuffer =
new StringBuffer(256)
.append(getCommandName())
.append(": ")
.append(message);
mailetContext.log(logBuffer.toString());
|
protected void | log(java.lang.String message, java.lang.Throwable t)Writes an explanatory message and a stack trace for a given Throwable
exception to the mailet log file, prepended by the mailet's name.
StringBuffer logBuffer =
new StringBuffer(256)
.append(getCommandName())
.append(": ")
.append(message);
mailetContext.log(logBuffer.toString(), t);
|
protected void | sendStandardReply(org.apache.mailet.Mail origMail, java.lang.String subject, java.lang.String message, java.lang.String replyAddress)Produces a standard response replyAddress to the sender
MailAddress senderAddress = origMail.getSender();
try {
MimeMessage mimeMessage = generateMail(senderAddress.toString(),
senderAddress.getUser(),
getCommandListservManager().getListOwner(),
getCommandListservManager().getListName(true),
subject,
message);
if (replyAddress != null) {
mimeMessage.setHeader(RFC2822Headers.REPLY_TO, replyAddress);
}
getMailetContext().sendMail(mimeMessage);
} catch (Exception e) {
throw new MessagingException(e.getMessage(), e);
}
|