How to setup SMTP relay on VPS (Ubuntu)?

additional :
Thanks for the answer.
Just learnt about SPF, think it should solve the primary problem.

A related problem I have:- on the site, there is a "email to friend" button, which basically sends an email out, which sets the 'From' paddock with whatever the user entered within as email.

Would that end up in spam? Anyway to stop (or at least restore?)

This web functionality would be captcha 'protected' for spam.
I am setting up a new website (myweb.com) on a VPS box(eg, myvps.com) that hosts other site/domains as well.

My interrogate is, how should smtp be set up?

Requirements:
- allow user to send emails to friends to tell them about interesting content via php,

ie,
From corral = email from any domain,
To field = email from any domain.

- website to send emails to users about registration details/accounts/news/etc.
myweb.com email is hosted on google app.

How should I set up postfix/sendmail?

Am concern email will shutting up in spam folder. I have looked into authsmtp and relay via google, but dislike the daily put a ceiling on, etc. Any other options?
Answers:   
By default, Ubuntu should allow you to send email from the local domestic device - ie. from PHP scripts running on the server. This isn't really an SMTP relay - an SMTP relay is required if you want to relay email from your own computer through this server using a mail client (Outlook, Thunderbird, whatever). This is reasonably straightforward to do with Postfix and Sendmail - use authenticated SMTP (AUTH LOGIN) and TLS/SSL so that you're not providing an spread out relay or exposing your passwords to the world.

If you're worried about emails originating from your VPS being flagged as spammy, build sure your IP address isn't blacklisted, set up SPF correctly, make sure that the emails you send contain unsubscription information, and make sure that you keep hold of third party scripts/Web applications up to date and that any scripts you write yourself don't allow people to relay spam through them.


Related Questions:
  • I want to set up a website on 2 VPS, to gross it more reliable. Is it possible? how can I do that?
  • Recommendations for Canadian VPS Web Host?
  • Where can i procure free VPS hosting?