You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Francis Lam <fl...@actioneer.com> on 2001/04/01 15:26:56 UTC
custom Mailet help
Hi all,
I have JAMES up and running on my system and I'm trying to write a custom
Mailet that will process the contents of an incoming message. The problem
that I'm having is that the jar package containing the code also contains
some resources (xml/xsl files), that I'm having trouble accessing properly.
When code in the jar attempts to retrieve the resource ( getResourceAsStream
call using the class's classLoader, which is AvalonClassLoader), the method
fails to find the resource contained in the jar. However, using the
ClassLoader obtained from getSystemClassLoader (), it all works well. I was
wondering if there was a way around this, or if there is a more proper way
to access resource files. Thanks.
Francis Lam
---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org
Multiple domains : experiment
Posted by Diego <ja...@itempd.it>.
I've modified the LocalDelivery Mailet service method :
Original method:
Collection recipients = mail.getRecipients();
Collection errors = new Vector();
for (Iterator i = recipients.iterator(); i.hasNext(); ) {
MailAddress recipient = (MailAddress) i.next();
try {
getMailetContext().storeMail(mail.getSender(), recipient,
mail.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
errors.add(recipient);
}
}
Modified method:
Collection recipients = mail.getRecipients();
Collection errors = new Vector();
for (Iterator i = recipients.iterator(); i.hasNext(); ) {
MailAddress recipient = (MailAddress) i.next();
try {
MailAddress domainRecipient=new
MailAddress(recipient.getHost()+"."+recipient.toString());/*ADDED*/
getMailetContext().storeMail(mail.getSender(),
domainRecipient, mail.getMessage()); /*MODIFIED*/
} catch (Exception ex) {
ex.printStackTrace();
errors.add(recipient);
}
}
This modified method store the incoming mail for account@domain as
domain.account@domain
now I can get two or more domains that use the same account:
I've tried this configuration in my mail server and it seems to work:
domains :
1)domain.com
2)domain.net
every domain have an info account
info@domain.com
info@domain.net
I have created two user accounts:
domain.com.info
domain.net.info
and configured user's mail client.
In this manner I can handle multiple domain with only one James instance.
BUT...
are there any side effects?
---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org