@@ -10,6 +10,12 @@ Disclaimer: This tool was just a quick implementation for our CI needs, which mi
1010
1111
1212## Usage:
13+ To install the program use:
14+ ```
15+ go install github.com/mobiuscode-de/imap-extractor@latest
16+ ```
17+
18+
1319To call the program use:
1420```
1521imap-extractor <path to config json>
@@ -29,19 +35,24 @@ The following configurations are to be included in the configuration:
2935* from-filter: Name filter for email origin
3036* regexp: Regex for which the emails will be scanned, including a group for the result
3137
38+ Any value might be preceded by a $ Symbol to indicate that its value shall be fetched by an environment variable.
3239
3340On execution this program will go through the inbox of given email address from newest to oldest.
3441Once any match with the given regex is found, the content of the first capturing group in the regex will be returned.
3542
3643
3744## Config Example:
45+ Basic example of a configuration to extract a line of content that is preceded by the text "please see:" and surrounded by arbitrary whitespace.
46+
3847``` json
3948{
4049 "imap-host" : " mobiuscode.de/" ,
4150 "imap-port" : 993 ,
4251 "username" : " user@mobiuscode.de" ,
43- "password" : " tryOutPanicMode " ,
52+ "password" : " $EMAIL_PW " ,
4453 "from-filter" : " boss@mobiuscode.de" ,
45- "regexp" : " please see important thing below :(?:[\\ s]+)([\\ S]+)(?:[\\ s]+)"
54+ "regexp" : " please see:(?:[\\ s]+)([\\ S]+)(?:[\\ s]+)"
4655}
47- ```
56+ ```
57+
58+ Note: Password is extracted from environment variable in this case, which is also recommended for usage of the tool in a CI environment.
0 commit comments