1

This is more of a general setup question, and I'm looking for information on where to get started.

Basically, I am using google apps to host my domains personal email, BUT I also need to send email from a hosted machine that appears to be from the same domain. The hosted machine never needs to read/get mail, only send it (from various php scripts). So basically, I have

  1. several users that use gmails [email protected] interface
  2. several php scripts that are attempting to send email from [email protected]. Note: Sending emails from the PHP scripts to another domain works fine.

Here is where I don't know what to do:

  1. Sending emails from the PHP server to my google app users, who have addresses like [email protected] always FAILS with an error. Postfix detects that I am 'sending an email to myself', and aborts. What I would like it to do is to treat foo.com like any other domain, and look up its MX record and send the email as normal.

  2. Also, i've noticed that it defaults to setting the from address to [email protected]. Is there anyway to change this?

Here is my main.cf file if this helps: myhostname = foo.com mydomain = foo.com

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

Thanks

2 Answers 2

1

The problem is having your hostname set to your domain name. By default postfix sets mydestination to include $myhostname. If your hostname were server1.$mydomain, your config would work. As it stands, postfix thinks that mail for $mydomain shoudl be handled locally yet local delivery is disabled, so it gives up.

In general, hostnames should not be your domain name, but rather a subdomain of your domain name.

0

Regarding your second question, the from address can be set using the additional_headers parameter of the PHP mail() function, see http://php.net/manual/en/function.mail.php - the second example at the bottom of that page shows how to set the From address.

You must log in to answer this question.