PDA

View Full Version : MX Exchanger



kenyoung
10-03-2003, 04:36 PM
I have multiple domains hosted on a VPS. From the control panel, it appears that I can only specify the MX record/mail server for one domain - the one I first sign-up with. Thus, when mail is sent to other domain names in my DNS, the mail bounces back because the mail exchanger or IP cannot be found. Interesting thing is if I try to send the email from the one domain to another on the same server, it works.

How do I specify the mail server to be used for other domains from 1) control panel or 2) some way from the linux shell?

What I like to do is allow others to email not just to the first domain I sign-up with, but also other domains that I put in my DNS. Whether or not they go to the same mail server is not a concern at this point.

Thanks!

PontusM
10-28-2003, 01:46 AM
I would also like to know if this is possible somehow. According to the WestHost site, you should be able to receive email at any of your domains, but they will all go to the same server. I thought this worked?

I'm interested in knowing if it's possible to assign different mailboxes to users in different domains (i.e. JohnDoe in domain1 does not share mailbox with JohnDoe in domain2). Maybe this is possible with some ProcMail magic?

FZ
10-28-2003, 03:17 AM
Hmm, I have this situation working. I have a primary domain, and had another domain added as a pointer to my account. I added it via domain management and enabled "use local mail server" (can't remember exactly what the option is called). Initially this did not work - it added the domain and everything, but mail was not working. I e-mailed WestHost and told them about this, and they changed something (a DNS entry I think) and suddenly it started working. Not sure exactly what they changed though.

Oh and it is possible to separate e-mail sent to different domains (yup, it's Procmail again). What I do is check to see if the To: is to my secondary domain. If it is, I just "move" this e-mail to a different POP3 that I use only for mail sent to the secondary domain. My primary domain's e-mail remains unaffected. If you'd like me to help you with that, let me know.

PontusM
10-29-2003, 02:12 AM
Sweet! Yea, maybe you could post a brief example here from your ProcMail file? I've read a bit about ProcMail but I'm not a wiz yet... :)

FZ
10-29-2003, 11:04 AM
PontusM,

The easiest way to do this (I didn't do it this way, more on that later) is to add the following lines to the end of your /etc/procmailrc (add a blank line between the last existing line in the file and then paste this):


:0:
* ^TO_yourseconddomain.com
/var/spool/mail/mailaccountname


You need to replace "yourseconddomain.com" with (obviously) the domain name that you want to filter mail for. "mailaccountname" also needs to be replaced with the name of the mail account you have created that you will use for all mail sent to your secondary domain. So, the above will "move" all mail (regardless of what is before the @) sent to your secondary domain to the mail account you specify. Of course, if necessary, you could expand on this to differentiate between different usernames (i.e. different values before the @) like this:


:0:
* ^TO_sales@yourseconddomain.com
/var/spool/mail/sales2

:0:
* ^TO_info@yourseconddomain.com
/var/spool/mail/info2


Just a note if you are going to make these changes via FTP: make sure to upload the changed file in ASCII/plain text mode, and once you are done that do a CHMOD 644 procmailrc. You may also want to make a backup of the original file, just in case. Make sure to test thoroughly using an external, non-WestHost mail account (e.g. Hotmail or Yahoo) before you assume it is working correctly.

Alright, so what is different with the way I am doing it, you ask? Well, I created the mail account with a home directory specified. The reason I did this is because I wanted to customise Procmail settings for incoming mail on my secondary domain (I get way too much spam and virii on it!). Another reason is because I wanted to run SpamAssassin on incoming mail for the secondary domain (something I don't do for any other e-mail account, since they don't need it). This solution is not perfect though, there are a couple of minor bugs with my implementation, but nothing major. If this is what you would like to do, let me know and I'll expand on the code above.

Good luck ;)

FZ
11-19-2003, 11:03 AM
Just an update on the above to make sure ALL mail for the second domain is caught:


:0:
* ^TO_seconddomain.com|^Received.*seconddomain.com
/var/spool/mail/mailaccountname


:0:
* ^TO_sales@seconddomain.com|^Received.*sales@second domain.com
/var/spool/mail/sales2

:0:
* ^TO_info@seconddomain.com|^Received.*info@seconddo main.com
/var/spool/mail/info2

What that will do is filter mail that does not have the address in question in To: or CC: or BCC: (i.e. most likely spam) but is meant for that address nontheless (i.e. because the Received: header would have: "for address@yourseconddomain.com").

PontusM, you never mentioned if this worked for you or not? :(

PontusM
11-20-2003, 10:36 AM
Aww, sorry FZ! I actually haven't tried it yet because it is not needed right now since I only got one domain. However, it WILL be needed in a month or two so that's why I asked. When I try it I will tell you how it went :)

FZ
11-20-2003, 10:46 AM
Hehe, okay, it's cool... Don't worry about it. Just wanted to make sure you were able to use it/get it working.