Go to file
2023-04-04 14:29:34 -04:00
data Add (and partly ignore) data folder 2018-01-03 04:07:57 -05:00
.env.example Use __DIR__ magic constant instead of environment variable 2018-01-18 02:26:14 -05:00
.gitignore Support a .env file, include a .env.example 2018-01-03 04:23:49 -05:00
composer.json Add phpdotenv 2018-01-03 04:17:24 -05:00
composer.lock Add phpdotenv 2018-01-03 04:17:24 -05:00
getmappings.php error handling on mappings 2023-04-04 14:29:17 -04:00
README.md Add a README 2018-03-26 12:05:43 -04:00
redirect.php Fix redirection when there's a forward with a From line 2018-01-24 18:50:25 -05:00

README

Installation

  • git clone this repository on to a server with incoming SMTP enabled. I recommend running both a live and test copy. For instance, store in both /usr/local/bin/redirect and /usr/local/bin/redirect_test.
  • In /etc/aliases, set up aliases. E.g.:
support: "| /usr/local/bin/redirect/redirect.php"                               
support-test: "| /usr/local/bin/redirect_test/redirect.php"
  • Run newaliases as root for the aliases to take effect.
  • Run composer install in the directory to install dependencies.
  • Copy .env.example to .env.
  • Open .env and fill in the appropriate environment values. Note that for the boolean values (e.g. DEBUG_MODE), you should leave the values blank for false.
  • (Optional) Add a custom field in Redmine called "Email Domain" to the Projects entity of type "Text". Populate this with the domain name that emails come from. This catches users from the organization who don't otherwise haev an account.
  • Run php getmappings.php to test your settings. If you've set everything up correctly, it should populate two CSVs in the data folder: domainmap.csv and usermap.csv.
  • If you have special emails that should be handled differently, you can create a specialusers.csv file in the data folder with the same format as records in usermap.csv. This file is concatenated on to the end of whatever users come from Redmine.
  • Set up a cron job to generate the mappings. I run this once per hour:
45 3 * * * /usr/bin/php /usr/local/bin/redirect_test/getmappings.php
45 4 * * * /usr/bin/php /usr/local/bin/redirect/getmappings.php