Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two domains: d1.tld and d2.tld.

I would like to send emails from d2.tld with the mail from user@d1.tld

How should I set my MX record so that receiving mail servers will accept the message?

Is it:

d1.tld IN MX 10 mail.d2.tld

or

d2.tld IN MX 10 mail.d1.tld ?

At the same time I only want to receive emails on d1.tld when sent to an @d1.tld address - so I guess d1.tld should point at mail.d1.tld like this d1.tld IN MX 10 mail.d1.tld, right?

Side note: I set an SPF record that allows d2.tld to send messages with the mail from @d1.tld

share|improve this question
    
Neither of those mx records are needed. The spf record will potentially help, and won't hinder what you are trying to do. Have you tried it yet? Do you have access to the server you want to send mail from (d2.tld)? Do you have access to mail.d1.tld? –  becomingwisest Jul 26 '12 at 14:59
    
yes have access to both servers –  horen Jul 26 '12 at 15:17
add comment

2 Answers

If you only want mail.d1.tld to receive mail for the d1.tld domain, you only want 1 MX record of:

d1.tld IN MX 10 mail.d1.tld

having a SPF record for d1.tld that allows mail to be sent from mail.d2.tld should be ok.

Not sure where you want d2.tld emails to go, if anywhere?

mail.d2.tld would need to allow relaying for emails not being sent to its own domain name. You can normally do this by setting up IP ranges/subnets in the mail server config. Just make sure you dont configure it as a open relay if its open to the internet.

(Note: no MX record is really needed for someone to receive an email from your domain, but without it, NDR's, auto replies, etc, wont work. Spam filters may also check to make sure MX records exist).

share|improve this answer
    
d2.tld isn't supposed to receive any mails. That's why I set the MAIL FROM to @d1.tld. So you are saying I should set two records: 1. d1.tld IN MX 10 mail.d1.tld to receive the returning emails on d1.tld and 2. d2.tld IN MX 10 mail.d2.tld so that spam filters could find a matching MX record for d2.tld ? So spam filters won't bother that the MX record for d2.tld isn't pointing to d1.tld ? –  horen Jul 26 '12 at 15:20
    
SPAM filters are not only going to check if the MX exists, many of them also are going to check if the MX actually points to the same IP you are trying to send mail from. SPF is only implemented on a minority of domains and not every SPAM filter setup is using it for validation. –  the-wabbit Jul 26 '12 at 15:21
    
@syneticon-dj So what record should I set to avoid spam filters? –  horen Jul 26 '12 at 15:23
    
@syneticon-dj Are you saying I should set the MX record of d2.tld to d1.tld ? So d2.tld IN MX 10 mail.d1.tld ? –  horen Jul 26 '12 at 15:24
    
@syneticon-dj And then should I put an A record on mail.d1.tld that points to the IP of d1.tld ? –  horen Jul 26 '12 at 15:26
show 3 more comments

The "proper" kind of setup here would be to set up mail.d1.tld in a way that would allow hosts from d2.tld sending through it with the envelope address of d1.tld. Anything else would either present an overly complex configuration or result in your mail being caught in SPAM filters.

Your RR d1.tld IN MX 10 mail.d1.tld would direct mail to d1.tld to the host mail.d1.tld. Note, that mail.d1.tld has to be an A-RR, it must not be a CNAME.

share|improve this answer
    
What about this version? d1.tld IN MX 10 mail.d1.tld, d2.tld IN MX 10 mail.d1.tld and mail.d1.tld IN A 123.456.789.0 ? –  horen Jul 26 '12 at 15:47
    
@horen should mail.d1.tld handle the mail for d2.tld as well? If you do not need mail for d2.tld, you don't need an MX RR for it either. –  the-wabbit Jul 26 '12 at 15:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.