Edgewall Software

Changes between Version 3 and Version 4 of Email2tracOnWindows


Ignore:
Timestamp:
Jan 29, 2016, 5:37:55 PM (6 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • Email2tracOnWindows

    v3 v4  
    1 1. A way to receive emails on your Trac server
    21
    3 When I setup email2trac, I thought that this step was going to be the most difficult (mostly because I have no experience with email servers/services).  Surprisingly, it is actually the easiest step.  The trick is to install the SMTP server, but not the POP server, so that emails are received and left as files in the "drop" folder.  (This is the way an email server hands off email between the two services)  In a way, email2trac performs the distribution functions normally handled by POP.
     2= Running Email2trac On Windows
    43
    5 Install the SMTP service via Windows Components.  Open Add/Remove Programs (Start->Control Panel->Add or Remove Programs)  Click "Add/ Remove Windows Components" in the left-hand bar.  Use the "Details..." button to drill-in to Application Server->Internet Information Services (IIS)->SMTP Service.  Check the box next to SMTP Service, click "OK", "OK", "Next", "Finish".
     4This page describes the steps to take to set up Email2trac on a Windows server running Trac.
    65
    7 I don't remember if I had to configure anything for SMTP (If I did, it wasn't much).  You find configuration at Start->Control Panel->Admistrative Tools->Internet Information Services (IIS) Manager.  I have "Default SMTP Virtual Server" listed, with a Domain Name of "trac-server.domain.com" with Type "Local (Default)".  I believe the installation automaticly creates the drop folder at C:\Inetpub\mailroot\Drop.  You can see that my email2trac batch script picks up .eml files from that location.
     6When setting up email2trac, the trick is to install the SMTP server, but not the POP server, so that emails are received and left as files in the "drop" folder. This is the way an email server hands off email between the two services. In a way, email2trac performs the distribution functions normally handled by POP.
    87
    9 To actually get emails to the server, you have to use the address "anyth...@trac-server.domain.com".  Your exchange or other mail server should automaticly forward the emails to the server.  If you want to use a different form, you will likely have to configure your mail server to forward the mail.  The name before the @ can be anything; POP service usually uses this, SMTP and email2trac ignore it.  A
    10 possible enhancement to email2trac would be to use the address to identify the destination environment for the ticket.
     8Install the SMTP service via Windows Components. Go to your Control Panel, then "Add or Remove Programs".
    119
    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.
     10Click "Add/ Remove Windows Components" in the left-hand bar. Use the "Details..." button to drill-in to Application Server -> Internet Information Services (IIS) -> SMTP Service. Check the box next to SMTP Service, click "OK", "OK", "Next", "Finish".
    1311
    14 A bit about my working solution:
     12I don't remember if I had to configure anything for SMTP (If I did, it wasn't much). You find configuration at Start -> Control Panel -> Admistrative Tools -> Internet Information Services (IIS) Manager. I have "Default SMTP Virtual Server" listed, with a Domain Name of "trac-server.domain.com" with Type "Local (Default)". I believe the installation automatically creates the drop folder at C:\Inetpub\mailroot\Drop. You can see that my email2trac batch script picks up .eml files from that location.
    1513
     14To actually get emails to the server, you have to use the address "anyth...@trac-server.domain.com". Your Exchange Server or other mail server should automatically forward the emails to the server. If you want to use a different form, you will likely have to configure your mail server to forward the mail. The name before the at-sign (@) can be anything. POP service usually uses this, SMTP and email2trac ignore it. A possible enhancement to email2trac would be to use the address to identify the destination environment for the ticket.
    1615
    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
     16The working solution:
     17
     18'''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. Relevant .fetchmailrc file: poll mail.domain.com with proto IMAP, auth ntlm user "t...@domain.com" with password "xxx" is trac here options keep
    1819mda "C:/python25/python.exe C:/projects/email2trac/email2trac.py"
    1920
    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'''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.
    2122
    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 * 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
    2324
    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 * 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.
    2526
    26 Note: See https://oss.trac.surfsara.nl/email2trac/wiki/Email2tracConfiguration
    27 for complete configuration instructions.
     27'''Note''': See https://oss.trac.surfsara.nl/email2trac/wiki/Email2tracConfiguration for complete configuration instructions.
    2828
     29'''3. email2trac.conf''' -- Matthew covered this, but might as well mention it again along with a caveat I found related to using email2trac with Trac 0.11. The important configuration variables are:
     30{{{
     31[DEFAULT]
     32project: C:\projects\trac\environmentname
     33tmpdir: C:\tmp
     34ticket_update: 1
     35strip_signature: 1
     36python_egg_cache: C:\Python25\Scripts
     37trac_version: 0.11
     38}}}
    2939
    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
     40Obviously, if you don't wish to strip signatures, you would set that to 0. The trac_version variable is important if you're running Trac 0.11, so that you don't receive an error like "str object is not callable". See https://oss.trac.surfsara.nl/email2trac/ticket/34 for more information about the background of this one.
    4041
     42'''4. Making it all work together''' -- I created a simple batch file that is run by Scheduled Tasks. All it does is run fetchmail:
    4143
    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://oss.trac.surfsara.nl/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 
     44{{{
    5345C:\cygwin\bin\fetchmail -v --fetchmailrc C:/cygwin/path/to/fetchmailrc
    5446--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 
     47}}}