Skip to content

Commit af502ec

Browse files
committed
Fixed mail parsing issues with imap email
1 parent 972abb1 commit af502ec

File tree

4 files changed

+683
-0
lines changed

4 files changed

+683
-0
lines changed

email/1.2.0/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Base our app image off of the WALKOFF App SDK image
2+
FROM frikky/shuffle:app_sdk as base
3+
4+
# We're going to stage away all of the bloat from the build tools so lets create a builder stage
5+
FROM base as builder
6+
7+
# Install all alpine build tools needed for our pip installs
8+
RUN apk --no-cache add --update alpine-sdk libffi libffi-dev musl-dev openssl-dev
9+
10+
# Install all of our pip packages in a single directory that we can copy to our base image later
11+
RUN mkdir /install
12+
WORKDIR /install
13+
COPY requirements.txt /requirements.txt
14+
RUN pip install --prefix="/install" -r /requirements.txt
15+
16+
# Switch back to our base image and copy in all of our built packages and source code
17+
FROM base
18+
COPY --from=builder /install /usr/local
19+
COPY src /app
20+
21+
# Install any binary dependencies needed in our final image
22+
# RUN apk --no-cache add --update my_binary_dependency
23+
24+
# Finally, lets run our app!
25+
WORKDIR /app
26+
CMD python app.py --log-level DEBUG
27+

email/1.2.0/api.yaml

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
walkoff_version: 1.2.0
2+
app_version: 1.2.0
3+
name: email
4+
description: Email app
5+
tags:
6+
- email
7+
categories:
8+
- communication
9+
contact_info:
10+
name: "@frikkylikeme"
11+
url: https://github.com/frikky
12+
13+
actions:
14+
- name: send_email_shuffle
15+
description: Send an email from Shuffle
16+
parameters:
17+
- name: apikey
18+
description: Your https://shuffler.io apikey
19+
multiline: false
20+
example: "https://shuffler.io apikey"
21+
required: true
22+
schema:
23+
type: string
24+
- name: recipients
25+
description: The recipients of the email
26+
multiline: false
27+
28+
required: true
29+
schema:
30+
type: string
31+
- name: subject
32+
description: The subject to use
33+
multiline: false
34+
example: "SOS this is an alert :o"
35+
required: true
36+
schema:
37+
type: string
38+
- name: body
39+
description: The body to add to the email
40+
multiline: true
41+
example: "This is an email alert from Shuffler.io :)"
42+
required: true
43+
schema:
44+
type: string
45+
returns:
46+
schema:
47+
type: string
48+
- name: send_email_smtp
49+
description: Send an email with SMTP
50+
parameters:
51+
- name: username
52+
description: The SMTP login username
53+
multiline: false
54+
example: "[email protected]"
55+
required: true
56+
schema:
57+
type: string
58+
- name: password
59+
description: The password to log in with SMTP
60+
multiline: false
61+
example: "******************"
62+
required: true
63+
schema:
64+
type: string
65+
- name: smtp_host
66+
description: The host of the SMTP
67+
multiline: false
68+
example: "smtp-mail.outlook.com"
69+
required: true
70+
schema:
71+
type: string
72+
- name: smtp_port
73+
description: The port to use for SMTP
74+
multiline: false
75+
example: "587"
76+
required: true
77+
schema:
78+
type: string
79+
- name: recipient
80+
description: The receiver(s) of the email
81+
multiline: false
82+
83+
required: true
84+
schema:
85+
type: string
86+
- name: subject
87+
description: The subject of the email
88+
multiline: false
89+
example: "This is a subject, hello there :)"
90+
required: true
91+
schema:
92+
type: string
93+
- name: body
94+
description: The body to add to the email
95+
multiline: true
96+
example: "This is an email alert from Shuffler.io :)"
97+
required: true
98+
schema:
99+
type: string
100+
- name: attachments
101+
description: Send files from shuffle as part of the email
102+
multiline: false
103+
example: "file_id1,file_id2,file_id3"
104+
required: false
105+
schema:
106+
type: string
107+
- name: ssl_verify
108+
description: Whether to use TLS or not
109+
example: "true"
110+
required: false
111+
options:
112+
- true
113+
- false
114+
schema:
115+
type: string
116+
returns:
117+
schema:
118+
type: string
119+
- name: get_emails_imap
120+
description: Get emails using IMAP (e.g. imap.gmail.com / Outlook.office365.com)
121+
parameters:
122+
- name: username
123+
description: The SMTP login username
124+
multiline: false
125+
example: "[email protected]"
126+
required: true
127+
schema:
128+
type: string
129+
- name: password
130+
description: The password to log in with SMTP
131+
multiline: false
132+
example: "******************"
133+
required: true
134+
schema:
135+
type: string
136+
- name: imap_server
137+
description: The imap server host
138+
multiline: false
139+
example: "Outlook.office365.com"
140+
required: true
141+
schema:
142+
type: string
143+
- name: foldername
144+
description: The folder to use, e.g. "inbox"
145+
multiline: false
146+
example: "inbox"
147+
required: true
148+
schema:
149+
type: string
150+
- name: amount
151+
description: Amount of emails to retrieve
152+
multiline: false
153+
example: "10"
154+
required: true
155+
schema:
156+
type: string
157+
- name: unread
158+
description: Retrieve just unread emails
159+
multiline: false
160+
options:
161+
- "false"
162+
- "true"
163+
required: true
164+
schema:
165+
type: bool
166+
- name: fields
167+
description: Comma separated list of fields to be exported
168+
multiline: false
169+
example: "body, header.subject, header.header.message-id"
170+
required: false
171+
schema:
172+
type: string
173+
- name: include_raw_body
174+
description: Include raw body in email export
175+
multiline: false
176+
options:
177+
- "false"
178+
- "true"
179+
required: true
180+
schema:
181+
type: bool
182+
- name: include_attachment_data
183+
description: Include raw attachments in email export
184+
multiline: false
185+
options:
186+
- "false"
187+
- "true"
188+
required: true
189+
schema:
190+
type: bool
191+
- name: upload_email_shuffle
192+
description: Upload email in shuffle, return uid
193+
multiline: false
194+
options:
195+
- "false"
196+
- "true"
197+
required: true
198+
schema:
199+
type: bool
200+
- name: upload_attachments_shuffle
201+
description: Upload attachments in shuffle, return uids
202+
multiline: false
203+
options:
204+
- "false"
205+
- "true"
206+
required: true
207+
schema:
208+
type: bool
209+
- name: ssl_verify
210+
description: Whether to use TLS or not
211+
example: "true"
212+
required: false
213+
options:
214+
- true
215+
- false
216+
schema:
217+
type: string
218+
- name: parse_email_file
219+
description: Takes a file from shuffle and analyzes it if it's a valid .eml or .msg
220+
parameters:
221+
- name: file_id
222+
description: file id
223+
required: true
224+
multiline: true
225+
example: 'adf5e3d0fd85633be17004735a0a119e'
226+
schema:
227+
type: string
228+
- name: file_extension
229+
description: Extension of file you want to convert
230+
required: true
231+
options:
232+
- eml
233+
- msg
234+
example: 'eml'
235+
schema:
236+
type: string
237+
- name: parse_email_headers
238+
description:
239+
parameters:
240+
- name: email_headers
241+
description: Email headers
242+
required: true
243+
multiline: true
244+
example: 'Email Headers'
245+
schema:
246+
type: string
247+
returns:
248+
schema:
249+
type: string
250+
returns:
251+
schema:
252+
type: string
253+
large_image: data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/hAytodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Nzg4QTJBMjVEMDI1MTFFN0EwQUVDODc5QjYyQkFCMUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Nzg4QTJBMjZEMDI1MTFFN0EwQUVDODc5QjYyQkFCMUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3ODhBMkEyM0QwMjUxMUU3QTBBRUM4NzlCNjJCQUIxRCIg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WLKSkHUWpmXl5xKR4BJAbJjD0/oTcEoeH1Uz5rbzfe0sUZlolH+pTigFelo3Nlr0UuyZgSYZn6vQ6zjKaQQpr6uz3yBI462WQhNvRVxDscMYVwvgujMYfwfh+n0Wly/ZZlJCVQw2k8tCABp9YypsL6iQAe0U8Unkj3YDcE6gAQO0EcEjmj3oN9wAE3tcA90p5n34VIcUm7bUutPgp7vn4wOpS05MNtiyZdAW0PKo+MASkuIbIulbPXKHNfOEa+V9m6zf7Vq633rcIpSoqbQ6T2lvdQo80coVxRbRMLRuVLuBts+VJ4iKnEhtb6ECwl0BxseVR8YAlJcQ2RdK2euUOa+cI18r7N1m/wBq1db71uEUpUVNodJ7S3uoUeaOUK4otomFo3Kl3A22fKk8RFTiQ2t9CBYS6A42PKo+MASkuIbIulbPXKHNfOPtKSkvNy6JiYaC3F71KJO+P//Z

email/1.2.0/requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
requests==2.25.1
2+
glom==20.11.0
3+
requests==2.25.1
4+
eml-parser==1.17.0
5+
msg-parser==1.2.0
6+
mail-parser==3.15.0
7+
extract-msg==0.23.1
8+
jsonpickle==2.0.0

0 commit comments

Comments
 (0)