Hi.

In most cases you shouldn't send email from @gmail through your server,
because gmail has SPF policy (srv record in DNS) and only gmail servers are
allowed to send emails from this domain (email sent from another IP will go
to spam).
You can configure your server to forward these emails via gmail server by
mimicking the email client (you would need to enable SMTP access in gmail I
believe).
To do so, you will configure SASL to authenticate your postfix as a gmail
client, and transport along with "sender_dependent_default_transport_maps"
to relay emails from @gmail.com via gmail servers.
(http://www.postfix.org/transport.5.html ,
http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps
)

But it is tricky, so let's start from the domain you own.

On your VPS you configure your Postifx as a regular MTA setting your domain
as "myhostname"  to your FQDN.
http://www.postfix.org/STANDARD_CONFIGURATION_README.html#local_network
but set "mynetworks = 127.0.0.0/8"

Check the following variables, and change them if they aren't configured
correctly:

http://www.postfix.org/postconf.5.html#myhostname
$ postconf -d myhostname
myhostname = your.server.full.name

http://www.postfix.org/postconf.5.html#myorigin
$ postconf -d myorigin
myorigin = $myhostname

Then try to send an email:
$ mail some_external_a...@foo.bar

If it works, then your VPS server can now send emails from your domain (I
suggest to configure SPF for your domain at this point:
https://mediatemple.net/community/products/dv/204404314/how-can-i-create-an-spf-record-for-my-domain
)

Note:
$ postconf -d mynetworks
should only contain 127.0.0.0 for now

Now we need to set this server as smarthost (aka relayhost) for your home
server.

If you have public static IP, then you can simply set it to the "mynetworks"
http://www.postfix.org/BASIC_CONFIGURATION_README.html#relay_from
This will tell Postifx "accept and relay all emails from this IP". You only
need to set VPS IP as smarthost then.

If no, you would need to authenticate your home server using SASL: SMTP
servers use it to authenticate clients
http://www.postfix.org/SASL_README.html

Since the Internet is a public network, you may need to enable TLS (which
provides encryption) (http://www.postfix.org/TLS_README.html#server_tls)
and configure your home server to use it (we do not want your ISP sniffing
your email content)

Questions:
* Do you have public static IP at home? Configuring SASL is only worth
doing if you do not.
* How do you want to receive emails for your domain? Do you want them to
arrive at your VPS so you can fetch them using pop/imap or forward them
somewhere?

Reply via email to