Skip to content

Commit b51d016

Browse files
committed
Updated readme with more indetail example
1 parent d7a9dcf commit b51d016

1 file changed

Lines changed: 40 additions & 13 deletions

File tree

README.md

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To install the program use:
1414
```
1515
go install github.com/mobiuscode-de/imap-extractor@latest
1616
```
17+
or download a binary from the latest github-release.
1718

1819

1920
To call the program use:
@@ -25,24 +26,23 @@ For detailed description of config json see below. Configured regex needs to con
2526
Result will be content of group of first match found in the email inbox.
2627
Additional unnamed groups may be used inside the regex.
2728

28-
## Parameters:
29+
## Usage example:
2930

30-
The following configurations are to be included in the configuration:
31-
* imap-host: Url on which the email host can be reached
32-
* imap-port: Port on which the IMAP protocol is offered (Usually 143 or 993)
33-
* username: Login username for email host
34-
* password: Password for above username
35-
* from-filter: Name filter for email origin
36-
* regexp: Regex for which the emails will be scanned, including a group for the result
31+
Given you have an email looking like this:
32+
```
33+
Dear Email recepient,
34+
I am sending you this email with random content.
35+
It contains a super important code later on though.
3736
38-
Any value might be preceded by a $ Symbol to indicate that its value shall be fetched by an environment variable.
37+
For future reference please see:
3938
40-
On execution this program will go through the inbox of given email address from newest to oldest.
41-
Once any match with the given regex is found, the content of the first capturing group in the regex will be returned.
39+
ImportantCode42
4240
41+
Make sure you keep that important code.
42+
Kind regards
43+
```
4344

44-
## 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.
45+
A configuration to extract the code detailed in the email could look something like this:
4646

4747
```json
4848
{
@@ -56,3 +56,30 @@ Basic example of a configuration to extract a line of content that is preceded b
5656
```
5757

5858
Note: Password is extracted from environment variable in this case, which is also recommended for usage of the tool in a CI environment.
59+
60+
Above configuration can then be passed to the tool to go through the email inbox configured:
61+
62+
```
63+
imap-extractor imap-config.json
64+
> ImportantCode42
65+
```
66+
67+
The tool will prioritize the latest emails found and will only return the first match.
68+
69+
70+
71+
## Parameters:
72+
73+
The following configurations are to be included in the configuration:
74+
* imap-host: Url on which the email host can be reached
75+
* imap-port: Port on which the IMAP protocol is offered (Usually 143 or 993)
76+
* username: Login username for email host
77+
* password: Password for above username
78+
* from-filter: Name filter for email origin
79+
* regexp: Regex for which the emails will be scanned, including a group for the result
80+
81+
Any value might be preceded by a $ Symbol to indicate that its value shall be fetched by an environment variable.
82+
83+
On execution this program will go through the inbox of given email address from newest to oldest.
84+
Once any match with the given regex is found, the content of the first capturing group in the regex will be returned.
85+

0 commit comments

Comments
 (0)