|
1 | 1 |
|
2 | | -## Imap Extractor |
| 2 | +# Imap Extractor |
3 | 3 |
|
4 | 4 | This is a very basic tool to scan an email-inbox for certain content. |
5 | 5 |
|
6 | | -The parameters are passed through a configuration file in json format, an example can be seen in "example-config.json". |
| 6 | +The parameters are passed through a configuration file in json format, an example can be seen in below. |
7 | 7 | The path to said configuration shall be passed as first parameter of the program. |
8 | 8 |
|
| 9 | +Disclaimer: This tool was just a quick implementation for our CI needs, which might also be useful for others. |
| 10 | + |
| 11 | + |
| 12 | +##Usage: |
| 13 | +To call the program use: |
| 14 | +``` |
| 15 | +imap-extractor <path to config json> |
| 16 | +``` |
| 17 | + |
| 18 | +For detailed description of config json see below. Configured regex needs to contain at least one group. |
| 19 | +Result will be content of group of first match found in the email inbox. |
| 20 | +Additional unnamed groups may be used inside the regex. |
| 21 | + |
| 22 | +##Parameters: |
| 23 | + |
9 | 24 | The following configurations are to be included in the configuration: |
10 | 25 | * imap-host: Url on which the email host can be reached |
11 | | -* imap-port: Port on which the IMAP protocol is offered |
| 26 | +* imap-port: Port on which the IMAP protocol is offered (Usually 143 or 993) |
12 | 27 | * username: Login username for email host |
13 | 28 | * password: Password for above username |
14 | 29 | * from-filter: Name filter for email origin |
15 | 30 | * regexp: Regex for which the emails will be scanned, including a group for the result |
16 | 31 |
|
17 | 32 |
|
18 | 33 | On execution this program will go through the inbox of given email address from newest to oldest. |
19 | | -Once any match with the given regex is found, the content of the first capturing group in the regex will be returned. |
| 34 | +Once any match with the given regex is found, the content of the first capturing group in the regex will be returned. |
| 35 | + |
| 36 | + |
| 37 | +##Config Example: |
| 38 | +```json |
| 39 | +{ |
| 40 | + "imap-host": "mobiuscode.de/", |
| 41 | + "imap-port": 993, |
| 42 | + "username": "user@mobiuscode.de", |
| 43 | + "password": "tryOutPanicMode", |
| 44 | + "from-filter": "boss@mobiuscode.de", |
| 45 | + "regexp": "please see important thing below:(?:[\\s]+)([\\S]+)(?:[\\s]+)" |
| 46 | +} |
| 47 | +``` |
0 commit comments