redirect email to another server, other than mx record

On the EHCP server, we have domain.com, we are ONLY performing web hosting, no mail.
Inside domain.com we have a file called email_form.php
This page sends an email to info@domain.com. The EHCP is set up to receive ANY mail that is sent to it. Meaning the web-site domain.com will also send its mail to the local host to be processed, if the local host CAN accept mail for domain.com, it will.

It is kinda hard to explain.

The mail generated from the web form is sent to the local mailer to be processed (sent out). If the local mailer, IS postfix, and postfix can accept mail for the domain sending the mail, then it will search for the email address located inside the virtual mailbox. IF the virtual mailbox (or email address) doesn't exist then postfix bounces it, back to the sender, and the sender IS the local domain name email address.

[WEb Server] [ email server]
hosts domain.com host domain.com
(has postfix) (has postfix)

if the web server sends email to domain.com, then the web-server will accept the mail for domain.com.
A DNS request is never performed.

I hope this makes some sense.

On Mon, Jun 4, 2012 at 9:37 AM, ehcp.net wrote:

You say, "EHCP server WILL NOT accept any mail that is destined for
the domain names it hosts"
why the mail would arrive at this server, if mx record points to
another server ?
I mean, If you set mx record point to another server, the email should
never arrive at this ehcp server...

what you think ?

On Mon, Jun 4, 2012 at 4:32 PM, David wrote:
> No worries, on the relay, I got it to work. So this might help someone else,
> if you want to post it.
>
> To set up a successful relay, so that EHCP will NOT accept email destinted
> to a domain name it is hosting, perform these step.
>
> 1) Create a sasl_password file.
> sudo touch /etc/postfix/sasl_password
>
> 2) Edit /etc/postfix/sasl_password
> sudo vim /etc/postfix/sasl_password
>
> 3) Insert your username and password
> SMTP.DOMAIN.COM username_or_email-address:password
>
> 4) Now you have to make the file so that postfix can read it. - this will
> create a dot db file
> sudo postmap /etc/postfix/sasl_password
>
> 5) Edit the postfix configuration file.
> sudo vim /etc/postfix/main.cf
>
> On like 37 I have added these two lines
> smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
> relayhost = [YOUR_SMTP_HOST]:25
>
> Around line 51 comment out the two lines
> virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
> virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
>
> 6) Restart the postfix server
> sudo /etc/init.d/postfix restart
>
> You should NOW have a successful relay setup. Your EHCP server WILL NOT
> accept any mail that is destined for the domain names it hosts. This is very
> useful, if you use seperate EHCP server to host domain names. IE, 1 server
> for mail and 1 server for web.
>
> ---[ END ]---
>
> Correct me if I am wrong, I believe the multi-server structure would also
> correct this, when implementated.

Forums: