HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Creating Bulk E-Mail Forwards (http://www.howtoforge.com/forums/showthread.php?t=60118)

fatbear 5th January 2013 16:23

Creating Bulk E-Mail Forwards
 
I'm migrating e-mail accounts for a new customer and they have many hundreds of forwards for several users. For example:

support@domain.com -> person1@domain.com, person2@domain.com
info@domain.com -> person1@domain.com, person3@domain.com
...

There are so many that this would be a very time-consuming process if done by the GUI. Is there a way to do this via scripting on the CentOS host? Or, is there some other way of creating forwarding addresses in bulk?

Many thanks and Happy New Year!

tahunasky 5th January 2013 23:04

I think whatever you do is going to be time consuming.

But you could write a script to put the required info in the required file. The forward info is in a .sieve file in the users mail dir:

/var/vmail/[domain]/[user]/.sieve

And it looks like this.

require ["fileinto", "regex", "date", "relational", "vacation"];
redirect "someone1@somedomain.com";
redirect "someone2@somedomain.com";
keep;

fatbear 6th January 2013 02:49

1 Attachment(s)
@tahunasky - thanks for the feedback. I think, however, the forwards are stored in the dbispconfig database.

Please find attached my first work-in-progress at doing bulk updates. It presently requires that the script be modified to manually define the USERID and the GROUPID for the source domain. Just update the first couple of lines in the script. And the script takes its input from a file that defines the bulk mappings. The script has simple usage instructions in it. Lastly, only one domain can presently be done at a time. Nevertheless, I used it today and it saved me a lot of time.

I will update this script to be able to handle the general case and will update this thread when I've completed that task.

Happy New Year!

tahunasky 6th January 2013 03:48

You are right.... there are 2 forwards, one in the database, which is an alias without a mailbox and the other uses sieve custom rules.

Your script looks good, but is a forwarding_id needed ?


All times are GMT +2. The time now is 16:07.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.