FileDocCategorySizeDatePackage
RemoveMailAttribute.javaAPI DocApache James 2.3.13118Fri Jan 12 12:56:30 GMT 2007org.apache.james.transport.mailets

RemoveMailAttribute

public class RemoveMailAttribute extends org.apache.mailet.GenericMailet
This mailet sets attributes on the Mail. Sample configuration: <mailet match="All" class="RemoveMailAttribute"> <name>attribute_name1</name> <name>attribute_name2</name> </mailet>
version
CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
since
2.2.0

Fields Summary
private ArrayList
attributesToRemove
Constructors Summary
Methods Summary
public java.lang.StringgetMailetInfo()
Return a string describing this mailet.

return
a string describing this mailet

    
                     
       
        return "Remove Mail Attribute Mailet";
    
public voidinit()
Initialize the mailet

throws
MailetException if the processor parameter is missing

        String name = getInitParameter("name");

        if (name != null) {
            StringTokenizer st = new StringTokenizer(name, ",") ;
            while (st.hasMoreTokens()) {
                String attribute_name = st.nextToken().trim() ;
                attributesToRemove.add(attribute_name);
            }
        }
    
public voidservice(org.apache.mailet.Mail mail)
Remove the configured attributes

param
mail the mail to process
throws
MessagingException in all cases

        Iterator iter = attributesToRemove.iterator();
        while (iter.hasNext()) {
            String attribute_name = iter.next().toString();
            mail.removeAttribute (attribute_name);
        }