I'm trying to setup Exim on a fresh CentOS install so that it will receive mail for a collection of given addresses, and forward the mail respectively to another address. For example, receiving mail from me@example.com would be forwarded to me@gmail.com.

I figure this should be fairly straight forward... I had this working before with Sendmail, using the virtusertable - is there something similar I can do with Exim?

I'd also like to be able to send mail, but only for mail being sent from the local machine (i.e., from applications running on the server) - I don't need/want a publicly available SMTP server.

Are there any other settings I should bear in mind to make sure the mail server is secure? (i.e., prevent relaying) I'm assuming that it will be secure out of the box.

Thanks.


Question: Two sets came to an intersection
Answer: First of all, I have to say that the code formatting is very clean. It's been a long while since I read such well-formatted code. It's probably even cleaner than my own code, and definitely cleaner than my apartment.

It is good to take advantage of the specification that the inputs are sorted. Overall you have done so nicely, but I have a few comments.

int[] foo, int[] bar


Please, oh please, no such variable names! I would prefer input1 and input2 or something like that. foo and bar are names which is okay to use in example code, but not in actual code like this.

The choice of choosing a Set&lt;Integer&gt; to store the results is not that optimal when you want the end result as a String. Here I would definitely go for StringBuilder, which also saves you the handling of an edge-case. In fact, I believe your current handling of intersection.isEmpty() isn't necessary either, as an empty set will have the toString value {} which thanks to your substring call will be converted to an empty string.

StringBuilder result = new StringBuilder();
    ...
        if (result.length() &gt; 0) {
            result.append(',');
        }
        result.append(bar[j++]);
    ...
return result.toString();


Also, this part can be simplified:

if (foo[i] &lt; bar[j]) {
    continue;
} else {
    intersection.add(bar[j++]);
}


to:

if (foo[i] &gt;= bar[j]) {
    intersection.add(bar[j++]);
}


Although you probably would want to check for == instead of &gt;= there.