This article explains how to configure Mailtraq to route incoming external mail to the right mailbox. This is one of the most frequently asked questions of all, which is not surprising given the number of methods ISPs use.
Duplicated CC messages
To avoid the problems associated with routing POP3 collections you should receive mail direct into Mailtraq by SMTP, wherever possible - see www.mailtraq.com/guide for an explanation.
Receiving mail direct by SMTP eliminates mail duplications, allows much better anti-spam control and is generally more efficient.
So, what's the issue here?
The POP3 protocol was designed to be the end of the mail delivery line for a message. One consequence of this is that the SMTP envelope information is stripped from the message when it is placed in the ISPs POP3 mailbox. That means that when Mailtraq, or any mail server, collects the message and needs to route it the message envelope is no longer there. Mailtraq will route the message using the message header fields, but one of the issues you will face is the generation of duplicate messages from the CC and BCC fields. This article and POP3 - Message Routing help you address these problems.
The duplication happens because the POP3 service at the ISP 'sees' that there are multiple recipients for the message and makes a copy message for each recipient and places them all in the ISP mailbox. Mailtraq then collects the mail in the mailbox - including the duplicates created by the ISP.
The correct solution is always to receive your mail direct by SMTP which is the protocol designed for mail transfer between mail servers (Simple Mail Transfer Protocol), however if your situation is such that you cannot, then Mailtraq provides a number of tools to adjust the way POP3 collections route messages. These adjustments are explained below.
Let's start by looking at POP3 and SMTP as mail delivery protocols. As it travels towards you, mail is routed from machine to machine via SMTP. In most cases it gets as far as your ISP's mail system, where it waits for you to to make an Internet connection. Some ISPs will then send the mail to Mailtraq using SMTP, in which case Mailtraq will automatically route the mail into mailboxes matching the user part of the email address. However if the ISP keeps the mail in a POP3 mailbox for Mailtraq to collect it, it is a different story all together.
Before we configure Mailtraq to collect and route the mail, make sure you have added all the Users and Mailboxes that the mail will be routed to. You also need to check that your domain is listed in the Options | Server dialog so that Mailtraq knows what mail to accept as local.
Configure your Remote POP3 collection
Then we need to set up a Remote POP3 Mailbox entry in Mailtraq:
From the menu, click Options | Remote POP3.
Make sure the Enable POP3 checkbox is ticked, and click Add to make a new entry.
Fill in the Account Details tab with the information from the ISP.
If you're setting up a live system where there is a lot of mail waiting at the ISP for distribution, you may also want to check the 'Leave mail on server' entry so mail isn't lost whilst we configure the system.
Now view the Message Routing tab. What we put in this part of the dialog box depends entirely on your ISP's setup, and may need a bit of experimentation to get right.
Set up Routing
First for a known case, if the ISP is Demon Internet, select Enable Message Routing and click 'Use *ENV extension to POP3'. Routing will then be performed as if the mail is being received via SMTP.
Stopping message duplication
For all other ISPs we need to examine a sample email to see what they support. Set the dialog to 'Send to listed recipient' and choose a mailbox, say 'admin'.
Make sure there's some mail to collect, if needs be by sending a message from a Hotmail' account to firstname.lastname@example.org (where domain.com is your domain)
Remember you can't send an internal mail to perform the test, as Mailtraq will catch it and route it to a mailbox without the message going via the ISP.
Now go online and select Actions | Collect POP3 mail.
Open the Remote POP3 Mailboxes dialog and view the properties of your account. At the foot of the Account Details tab it should say 'Last collection:' and give a date. If it gives an error instead, correct your POP3 settings and try again.
Back in the Mailtraq console, select the Postmaster mailbox that we asked the mail to be routed to. You should find your test email here. Double click on the message to view it, as we need to examine the headers.
Your headers should look something like the example shown in the box.
Received: from pop3.isp.co.uk by enstar.net with POP3 (Mailtraq/22.214.171.1249)
id BB4479170FC; Sun, 03 Oct 1999 15:43:10 +0100
Received: from punt-2.mail.isp.net by mailstore for email@example.com
id 938901361:20:01050:2; Sat, 02 Oct 99 21:56:01 GMT
Received: from [126.96.36.199] ([188.8.131.52]) by punt-2.mail.isp.net
id aa2000956; 2 Oct 99 21:55 GMT
Subject: Test message
Date: Sat, 02 Oct 1999 21:44:10 GMT
X-Mailer: Forte Agent 1.5/32.451
Content-Type: text/plain; charset=us-ascii
In your headers, identify the 'To' header, and look for any other headers which have the same destination email address. In my example, I've highlighted X-Envelope-To, but you may find X-Apparently-To, X-Originally-To, or something else. (It will normally start with an X)
If you find anything, note the name of the header, and go back to the Message Routing tab of our Remote POP3 Mailbox. Select 'Enable Message Routing', select 'Use these header fields to identify recipients' and in the box remove any existing entries (To, CC etc) and type in the name of your header, exactly as shown in your email. You shouldn't type the colon at the end. Your routing should now be set up.
If you didn't find a matching header, look for a 'for' clause giving your test email address in the Received headers. If we're to rely on it being present in all incoming emails, it has to be in a Received header added by your ISP, not by someone earlier in the delivery chain, so it probably has to be in the top two or three Received headers, depending on their set up.
If you found a suitable 'for' entry, go back to the Message Routing tab of our Remote POP3 Mailbox. Select 'Enable Message Routing', select 'Extract recipient from received fields'. Your routing should now be set up.
No 'for' clause either' ?
It may be worth asking the ISP if they can modify their systems to provide one of the above hooks ' once the problem is explained to their tech staff they can be surprisingly helpful, particularly since if they can't help, the best option will be to change ISP. In the meantime, you can get Mailtraq to route based on the To and CC headers, which will work for simple emails sent directly to the recipient, but this won't work with emails from mailing lists and messages directed via blind copies. To do this, go back to the Message Routing tab of our Remote POP3 Mailbox. Select 'Enable Message Routing', select 'Use these header fields to identify recipients', and make sure To and CC are listed in the box below it.