Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm currently experimenting with working with Outlook.com for an email server, and have MX records set up to point there and the like. How can I configure systems like postfix to use external servers for mail? When I try to use functions like PHP's mail() for example, the server logs return this line, obviously because user isn't a user on my system, but rather is on an external mail server.

ABBAB100B92: to=<user@example.com>, relay=local, delay=0.06, delays=0.04/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "user")

Might it be easier to run a mail server right off of the VPS I'm hosting my website on, so that everything stays local? Or is that not a very good idea?

System is an Ubuntu 12.04.3 LTS

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

For Postfix, you need to set relayhost in your configuration, and some other options as well. There are many articles online explaining how to do this, for example this one.

Might it be easier to run a mail server right off of the VPS I'm hosting my website on, so that everything stays local?

I don't think that would be easier.

Or is that not a very good idea?

No, it's not, because email coming directly from your server will probably have a higher probability of being classified as spam based on its IP address than email coming from a reputable provider such as Outlook.com.

share|improve this answer
    
Right. I was able to set up the relay properly, however, in this particular case when I'm using a contact form, when the email is relayed through outlook, the from address is stripped because of the SMTP server. What I end up receiving is something like: To: user1@example.com From: user1@example.com Is there any way to preserve this info? I was able to to it when email was hosted on my server before moving to a VPS. –  Noel Forte Dec 30 '13 at 6:44
    
@NoelForte ah, yes, both Outlook.com and GMail rewrite FROM addresses for anti-spam reasons. You could add an additional header I suppose. –  Robin Green Dec 30 '13 at 7:20
    
What if I just set up an email server directly on my server? I know you said this isn't easier, and has potential to be blacklisted, but don't PTR Reverse DNS Records and SPF Records, as well as SSL Certs help prevent blacklisting? –  Noel Forte Dec 30 '13 at 21:14
    
Yes, good points. OK, maybe that would be better for this use case. –  Robin Green Dec 30 '13 at 21:16
    
One more question: Would you recommend using a separate VPS for email? Or is it better to run email and apache off of one box? –  Noel Forte Dec 30 '13 at 21:39
show 1 more 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.