1. Howto configure postfix to use a remote SMTP relay host
So you're running Linux, and your ISP is filtering traffic on port 25, thus blocking you from sending outgoing mail, and so you want to configure your mailserver to relay all your mail out through your ISP's server, like they want you to. If you're running postfix, this turns out to be very easy -- in /etc/postfix/main.cf, just set the variable:
relayhost = smtp.yourisp.com
then restart postfix (/etc/init.d/postfix restart, as root).
source:
http://www.gungeralv.org/notes/archives/2003/06/howto_configure_postfix_to_use_a_remote_smtp_relay_host.php
2.To allow postfix accept email relaying from a specific ip adress, we can edit /etc/postfix/main.cf:
You can add by ip address . Restart postfix and now postfix will consider the new IP addresses as trusted ip and allow email from this ip address relaying email using this postfix mail server
mynetworks = 127.0.0.0/8
to
mynetworks = 127.0.0.0/8, 192.168.0.1/24, 62.35.x.x/30
3. Howto relay mails for specific domains (like local ones), or which is 'global mx.records' are different from your want to relay mail
something like in microsoft exghange server 'connectors'
so for this propose, you could use /etc/postfix/transport file
somedomain.com smtp:[10.0.0.1]:25
or
somedomain.com smtp:domain_name.com:25
DONT FORGET TO:
postmap hash:/etc/postfix/transport
4.HowTo : add custom transport routes (maps) in postfix.
In postfix, when you need your e-mails for some specific domains to relay through another server ( your ip is blocked or for some other reason ) you can specify custom transport maps in the postfix config.
You have to setup postfix to use custom transport maps :
in main.cf enable the transport_maps directive :
transport_maps = hash:/etc/postfix/transport
then edit the file /etc/postfix/transport and add to it :
example.com smtp:your.second.mailserver.com
close it and then rebuild the transport database file by entering the following command :
postmap /etc/postfix/transport
restart postfix and now every e-mail sent to example.com will relay through your specified e-mail server.
5.How to configure postfix virtual domains
This is a plaintext file where you can specify the domains and users to accept mail for. Each virtual domain should begin with a single line containing the domain name. The subsequent lines define addresses at the domain that are deliverable. Mail will be delivered to local usernames on the right side, as demonstrated in the example below. The condition @domain allows you to deliver "all other" mail to the indicated user. You can list multiple domains in this file; just repeat the format demonstrated below.
example.com this-text-is-ignored
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
postmaster
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
destuser1
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
destuser2
@example.com destuser1
Edit /etc/postfix/main.cf
You have to tell postfix where to look for these virtual alias mappings; the appropriate configuration directive is in the main postfix configuration file. This tells postfix to use the db-format (hash) version of your virtual mappings. Note that your system must have db support for this to work; also, the actual db file is not created until you run 'postmap' in step 3.
virtual_alias_maps = hash:/etc/postfix/virtual
Refresh configuration and mappings
Since you've changed main.cf, you should restart the daemon. The second command below updates the virtual mappings; you must run this 'postmap' command when you change your /etc/postfix/virtual file. The 'postmap' command actually creates the hash db file that postfix looks for.
postfix reload
postmap /etc/postfix/virtual
Now try delivering mail to virtual domain addresses. If you encounter problems, check your mailer daemon system log and make sure your server configuration has been refreshed with 'postfix reload' and the 'postmap' commands.