Postfix setup to send mail only

postfix

I'm trying to setup postfix to send mail on my machine (Ubuntu 10.04). It only needs to send mail and will be used by the php mail() function in a few scripts. I have a google apps account that will receive all the mail for the domain (and it is currently working with no problems).

I've just installed postfix, and am trying to follow the configuration for a 'null' server from the postfix web site. i.e. my main.cf file looks like this:

/etc/postfix/main.cf:

myorigin = $mydomain
relayhost = $mydomain
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled

Also, I wasn't sure what to do when the instructions told me to change master.cf, so I haven't changed anything yet, but I don't think this should impact sending mail.
/etc/postfix/master.cf:
Comment out the local delivery agent entry

However I'm getting the following errors after trying to send an email to my personal account with the command:

sendmail -v spam@testaddress.com


Aug 31 18:52:53 tdmain postfix/qmgr[16387]: 32811101D2: from=<>, size=1843, nrcpt=1 (queue active)
Aug 31 18:52:53 tdmain postfix/smtp[16956]: warning: relayhost configuration problem
Aug 31 18:52:53 tdmain postfix/smtp[16956]: 32811101D2: to=<root@org.org>, relay=none, delay=0, delays=0/0/0/0, dsn=4.3.5, status=deferred (Host or domain name not found. Name service error for name=org type=A: Host not found)
Aug 31 18:59:57 tdmain postfix/qmgr[16387]: 2AF23101CC: from=<root@org.org>, size=309, nrcpt=1 (queue active)
Aug 31 18:59:57 tdmain postfix/qmgr[16387]: 32811101D2: from=<>, size=1843, nrcpt=1 (queue active)
Aug 31 18:59:57 tdmain postfix/smtp[17535]: warning: relayhost configuration problem
Aug 31 18:59:57 tdmain postfix/smtp[17536]: warning: relayhost configuration problem
Aug 31 18:59:57 tdmain postfix/smtp[17535]: 2AF23101CC: to=<spam@testaddress.com>, relay=none, delay=440, delays=440/0.01/0/0, dsn=4.3.5, status=deferred (Host or domain name not found. Name service error for name=org type=A: Host not found)
Aug 31 18:59:57 tdmain postfix/smtp[17536]: 32811101D2: to=<root@org.org>, relay=none, delay=424, delays=424/0.01/0/0, dsn=4.3.5, status=deferred (Host or domain name not found. Name service error for name=org type=A: Host not found)

Any ideas?

EDIT

Ok, i still don't really understand postfix, but the solution seems to be to remove everything after 'relayhost =', and to manually specify my mydomain and myhostname above.

Best Answer

The problem is your relayhost parameter, it should be the hostname of the SMTP server all mail should be sent to.

For the master.conf file, the line you want to comment out is the one that looks like:

local     unix  -       n       n       -       -       local