Posts Tagged ‘mail forwarding’

Create Email Forwarding with Qmail Vpopmail using .qmail file

Tuesday, June 11th, 2013

how to do forwarding on qmail with vpopmail qmail e mailbox screenshot logo

Even though Qmail is considered as obsolete email server lately and it lacks good systematical official documentation and requires a lot of "hacking" to make work. It is surely still the fastest and maybe securest mail server out there (if properly configured).
My Qmail uses Vpopmail (for Virtual Email hosting). Every now and them some client requires to add a new e-mail forwarding from E-mail mail@host.com to Email to mail1@host2.com. Though many like to use Web interface as QmailAdmin for adding the forward I still prefer do it via old fashioned way, by SSH-ing to qmail server host and manually creating .qmail file.

Location (of my Vpopmail) install is (/var/vpopmail), so (to add e-mail forwarding for sample mail – mail@host.com)  .qmail file needs to be created in dir /var/vpopmail/domains/host.com/mail/ with content:

/var/vpopmail/domains/host.com/mail/Maildir/
&mail@host1.com

qmail:~# echo '/var/vpopmail/domains/host.com/mail/Maildir/' > /var/vpopmail/domains/host.com/mail/.qmail

qmail:~# echo '&mail@host1.com' >> /var/vpopmail/domains/host.com/mail/.qmail

First file instructs, where to store a copy of received e-mail (copy is stored in Maildir of receipt e-mail).

In Second line is mail to which to forward. For forwarding to group of e-mails all e-mails has to be listed in .qmail, i.e.:

/var/vpopmail/domains/host.com/mail/Maildir/
&mail@host1.com
&mail1@host2.com
&mail3@host3.com

Finally to make just created .qmail file work peroperly user group permissions has to be fixed:

# chown -R vpopmail:vchkpw /var/vpopmail/domains/host.com/mail/Maildir/.qmail

How to configure mail server forwarding on Postfix – Email forwarding from one Postfix SMTP to another

Friday, March 1st, 2013

I needed to configure mail forwarding from one Postfix mail server with a correct MX and PTR record to another one for a reason the second mail server has filtered port 25, because of ISP policy. As it is recommended in such situations, I've configured mail forwarding from postfix host1 to host2 to use (submission) port number 587 which general purpose is for exactly situations like this. Mail forwarding is done via a simple /etc/postfix/main.cf, /usr/local/etc/postfix/main.cf (depending where Postfix is installed).

Thus as my postfix configs are in /etc/postfix, I edited /etc/postfix/main.cf on forwarding Postfix mail server, where mail comes in (host1) and added line:

relayhost = [123.123.123.123]:587

Where 123.123.123.123 is IP address of host2

To load settings I had to do the usual postfix restart

postfix# /etc/rc.d/postfix restart

postfix/postfix-script: stopping the Postfix mail system
postfix/postfix-script: starting the Postfix mail system

On host2 – to which mail is forwarded, I had to add access for host1 to relay mail  in /etc/postfix/main.cf had to include:

mynetworks = 124.124.124.124

and 124.124.124.124 is IP of host1

One note to make is if mynetworks is not defined to host of host1 mail server, you will get in /var/log/maillog error:

Relay access denied (in reply to RCPT TO command))

Here is paste chunk from /var/log/maillog

Mar  1 08:57:01 host1 postfix/smtp[95236]: 88C8B11F911:
                    to=<amaderit.for.brother+caf_=amaderit2013FINAL=forward-host.org@gmail.com>, relay=24.129.36.212[24.129.36.212]:587, delay=0.54,
                    delays=0.01/0/0.44/0.09, dsn=5.7.1, status=bounced (host 24.129.36.212[24.129.36.212] said: 554 5.7.1
                    <amaderit.for.brother+caf_=amaderit2013FINAL=forward-host.org@gmail.com>: Relay access denied (in reply to RCPT TO command))