1

Topic: Reroute all outgoing email to specific address

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version:  Debian 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

I want to create a test account in iRedMail to be used with development environments that send emails only to specified address, overriding the original recipient.

So, I want test@example.com to deliver ALL emails to devs@example.com and nowhere else, no matter who the recipient was in the first place.

Is this possible with iredmail?

Thanks

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Reroute all outgoing email to specific address

Hi,

as iredmail uses postfix :

To configure postfix to deliver all mail to our local user. To do this we use Postfix’s
address rewriting. First, edit /etc/postfix/main.cf and add the following at the bottom:

canonical_maps = regexp:/etc/postfix/canonical-redirect

Now create a new file

/etc/postfix/canonical-redirect and add the following.


/^.*$/ sampleuser

Sample user is the user you wish all email to go to
Save the file and restart Postfix:

sudo service postfix restart

more info : http://www.postfix.org/ADDRESS_REWRITIN … #canonical

And i am sure Zhang knows a few more ways to do this, but this is one of the simple ways.

Regards,

3

Re: Reroute all outgoing email to specific address

Thanks for the reply!

Will this affect only one account though, or every account on the system?
I want other accounts on the server to work normally and only test@example.com to work like that.

4

Re: Reroute all outgoing email to specific address

Looks like you need per-user mail forwarding. Try this:
http://www.iredmail.org/docs/sql.create.mail.alias.html

5

Re: Reroute all outgoing email to specific address

Zhang thanks for your reply.

I do not really understand what you mean by alias though. I want to have an account that can't send emails and all emails are re-routed to an address I specify.
So, if test@example.com sends an email to bill@acme.com I want this email to never reach Bill but go to mailtrap@example.com

So I will end with an account that can send emails but those emails are rerouted to an address I own.
The closest alternative I can find is this one: https://www.drupal.org/project/reroute_email
but it is not about the mail server.

Thanks

6

Re: Reroute all outgoing email to specific address

I suggest you try to create a mail alias account and send some testing email to verify whether or not it's what you're looking for, because IMO it's what you're looking for according to your explanation.

7

Re: Reroute all outgoing email to specific address

I just configured the alias like you suggested. It allows me to send incoming emails that are targeting one user to another user.

I'm trying to achieve the exact opposite though, I want to deal with outgoing emails.
I want the emails one account sends to go always to a predefined address.
With alias I can do that for the emails he receives, not for the mails he sends.

Thanks again for your help and your patience.

8

Re: Reroute all outgoing email to specific address

Oh, i'm sorry that i misunderstood your request.
Then you need @riverco's suggestion in post #2 (in this thread).

9

Re: Reroute all outgoing email to specific address

No problem,

I'm gonna give @riverco's suggestion a try.

Again, thanks smile

10

Re: Reroute all outgoing email to specific address

@riverco your suggestion is valid, thanks!

However, it renders the server useless for non-dev work.
Maybe my original topic title is wrong. It turns out it makes sense to redirect/reroute emails sent from one account, not from every account on the server.

That way, a single mail server can be used both for development and for normal mail delivery.