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 Diego <ja...@itempd.it> on 2001/04/02 14:01:17 UTC

Multiple domains : experiment

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