| 11 | |
| 12 | Thanks, Matthew, for your detailed response. It's amazing what a couple edits to the email2trac.py script can do! I'm happy to say that I've now got it all working smashingly. |
| 13 | |
| 14 | A bit about my working solution: |
| 15 | |
| 16 | |
| 17 | 1. Fetchmail -- Retrieves email from the Exchange server. I have it set up to automatically feed retrieved messages to the script so I don't need an additional script to do this. At some point I might want to change this piece of the equation to get rid of the overhead of the Cygwin component, but it's working and I like having to do a little Unix-y work. Relevant .fetchmailrc file: poll mail.domain.com with proto IMAP, auth ntlm user "t...@domain.com" with password "xxx" is trac here options keep |
| 18 | mda "C:/python25/python.exe C:/projects/email2trac/email2trac.py" |
| 19 | |
| 20 | 2. email2trac script -- As can be seen in the above .fetchmailrc file, I put my script and related files in the path C:/projects/email2trac. I made the changes to email2trac.py that Matthew mentions along with a couple changes specific to my solution. |
| 21 | |
| 22 | * Config file variable -- Since I'm calling the script from fetchmail, I needed to specify the full path to the config file in the email2trac.py script, i.e. C:/projects/email2trac/email2trac.conf |
| 23 | |
| 24 | * Signature stripping -- I found that the signature stripping done in the script when the strip_signature config variable was set didn't work correctly for the format of our emails so I made a slight edit to the script. In the section of the script that defines useful mail constants (around line 141), I added the variable self.get_signature_match = '---'. Then in the strip_signature method (around line 728) I replaced the line "if line == '-- ':" with "if line.startswith(self.get_signature_match):". This resulted in the successful stripping of most signatures as well as old original message info I didn't want to get added on each response. |
| 25 | |
| 26 | Note: See https://subtrac.sara.nl/oss/email2trac/wiki/Email2tracConfiguration |
| 27 | for complete configuration instructions. |
| 28 | |
| 29 | |
| 30 | 3. email2trac.conf -- Matthew covered this, but might as well mention |
| 31 | it again along with a caveat I found related to using email2trac with |
| 32 | trac 0.11. So, important config variables: |
| 33 | [DEFAULT] |
| 34 | project: C:\projects\trac\environmentname |
| 35 | tmpdir: C:\tmp |
| 36 | ticket_update: 1 |
| 37 | strip_signature: 1 |
| 38 | python_egg_cache: C:\Python25\Scripts |
| 39 | trac_version: 0.11 |
| 40 | |
| 41 | |
| 42 | Obviously, if you don't wish to strip signatures, you would set that |
| 43 | to 0. The trac_version variable is important if you're running trac . |
| 44 | 11 so that you don't receive an error like "str object is not |
| 45 | callable". See https://subtrac.sara.nl/oss/email2trac/ticket/34 for |
| 46 | more information about the background of this one. |
| 47 | |
| 48 | |
| 49 | 4. Making it all work together -- I created a simple batch file that |
| 50 | is run by Scheduled Tasks. All it does is run fetchmail. |
| 51 | |
| 52 | |
| 53 | C:\cygwin\bin\fetchmail -v --fetchmailrc C:/cygwin/path/to/fetchmailrc |
| 54 | --logfile c:/projects/email2trac/fetchmail.log |
| 55 | |
| 56 | |
| 57 | Thanks everyone for your responses and hopefully this can help someone |
| 58 | in the future! |
| 59 | |
| 60 | |