Added option to CommandListServ to change the to address.
---------------------------------------------------------
Key: JAMES-367
URL: http://issues.apache.org/jira/browse/JAMES-367
Project: James
Type: Improvement
Components: Matchers/Mailets (bundled)
Environment: N/A
Reporter: Daniel Perry
Priority: Minor
Attachments: patch.txt
I have added the option: <changetoaddress>[EMAIL PROTECTED]</changetoaddress>
to the CommandListServProcessor. When an email is sent to the list, it changes
the to address into this. Is useful in hiding the list address, or in any
other circmstances where you need to make it appear different. Note: it doesnt
change the received headers, so the address is still there if people look.
Daniel.
---
src\java\org\apache\james\transport\mailets\CommandListservProcessor_orig.java
Thu Apr 07 17:08:23 2005
+++ src\java\org\apache\james\transport\mailets\CommandListservProcessor.java
Thu Apr 07 16:47:05 2005
@@ -27,10 +27,11 @@
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.MailetException;
+import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.ParseException;
import java.io.IOException;
@@ -154,11 +155,13 @@
*/
protected XMLResources xmlResources;
protected boolean specificPostersOnly;
protected Collection allowedPosters;
-
+ protected boolean addFooter;
+ protected String changeToAddress;
+
/**
* Initialize the mailet
*/
public void init() throws MessagingException {
try {
@@ -170,10 +173,12 @@
subjectPrefix = getString("subjectprefix", null);
listName = getString("listName", null);
autoBracket = getBoolean("autobracket", true);
listOwner = new MailAddress(getString("listOwner", null));
specificPostersOnly = getBoolean("specifiedpostersonly", false);
+ addFooter = getBoolean("addfooter", true);
+ changeToAddress = getString("changetoaddress", null);
//initialize resources
initializeResources();
//init user repos
initUsersRepository();
initAllowedPosters(configuration);
@@ -206,17 +211,25 @@
if (!checkBeenThere(listservAddr, mail)) {
return;
}
//addfooter
- addFooter(mail);
-
+ if (addFooter){
+ addFooter(mail);
+ }
+
//prepare the new message
MimeMessage message = prepareListMessage(mail, listservAddr);
+
+
//Set the subject if set
setSubject(message);
+
+ if (changeToAddress!=null){
+ message.setRecipients(Message.RecipientType.TO,
changeToAddress);
+ }
//Send the message to the list members
//We set the list owner as the sender for now so bounces go to
him/her
getMailetContext().sendMail(listOwner, members, message);
} catch (IOException ioe) {
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]