Skip to content

Commit

Permalink
Added a new version of the email app with a msg/eml standard parser t…
Browse files Browse the repository at this point in the history
…hat handles attachments as files
  • Loading branch information
frikky committed Aug 5, 2023
1 parent ee03da3 commit 1f2e41b
Show file tree
Hide file tree
Showing 8 changed files with 996 additions and 2 deletions.
27 changes: 27 additions & 0 deletions email/1.3.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Base our app image off of the WALKOFF App SDK image
FROM frikky/shuffle:app_sdk as base

# We're going to stage away all of the bloat from the build tools so lets create a builder stage
FROM base as builder

# Install all alpine build tools needed for our pip installs
RUN apk --no-cache add --update alpine-sdk libffi libffi-dev musl-dev openssl-dev

# Install all of our pip packages in a single directory that we can copy to our base image later
RUN mkdir /install
WORKDIR /install
COPY requirements.txt /requirements.txt
RUN pip install --prefix="/install" -r /requirements.txt

# Switch back to our base image and copy in all of our built packages and source code
FROM base
COPY --from=builder /install /usr/local
COPY src /app

# Install any binary dependencies needed in our final image
# RUN apk --no-cache add --update my_binary_dependency

# Finally, lets run our app!
WORKDIR /app
CMD python app.py --log-level DEBUG

280 changes: 280 additions & 0 deletions email/1.3.0/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
walkoff_version: 1.3.0
app_version: 1.3.0
name: email
description: Email app
tags:
- email
categories:
- communication
contact_info:
name: "@frikkylikeme"
url: https://github.com/frikky
email: "frikky@shuffler.io"
actions:
- name: send_email_shuffle
description: Send an email from Shuffle
parameters:
- name: apikey
description: Your https://shuffler.io apikey
multiline: false
example: "https://shuffler.io apikey"
required: true
schema:
type: string
- name: recipients
description: The recipients of the email
multiline: false
example: "test@example.com,frikky@shuffler.io"
required: true
schema:
type: string
- name: subject
description: The subject to use
multiline: false
example: "SOS this is an alert :o"
required: true
schema:
type: string
- name: body
description: The body to add to the email
multiline: true
example: "This is an email alert from Shuffler.io :)"
required: true
schema:
type: string
returns:
schema:
type: string
- name: send_email_smtp
description: Send an email with SMTP
parameters:
- name: username
description: The SMTP login username
multiline: false
example: "frikky@shuffler.io"
required: true
schema:
type: string
- name: password
description: The password to log in with SMTP
multiline: false
example: "******************"
required: true
schema:
type: string
- name: smtp_host
description: The host of the SMTP
multiline: false
example: "smtp-mail.outlook.com"
required: true
schema:
type: string
- name: smtp_port
description: The port to use for SMTP
multiline: false
example: "587"
required: true
schema:
type: string
- name: recipient
description: The receiver(s) of the email
multiline: false
example: "frikky@shuffler.io,frikky@shuffler.io"
required: true
schema:
type: string
- name: subject
description: The subject of the email
multiline: false
example: "This is a subject, hello there :)"
required: true
schema:
type: string
- name: body
description: The body to add to the email
multiline: true
example: "This is an email alert from Shuffler.io :)"
required: true
schema:
type: string
- name: attachments
description: Send files from shuffle as part of the email
multiline: false
example: "file_id1,file_id2,file_id3"
required: false
schema:
type: string
- name: ssl_verify
description: Whether to use TLS or not
example: "true"
required: false
options:
- true
- false
schema:
type: string
- name: body_type
description: The type of body to send. HTML by default
example: "true"
required: false
options:
- "html"
- "plain"
schema:
type: string
returns:
schema:
type: string
- name: get_emails_imap
description: Get emails using IMAP (e.g. imap.gmail.com / Outlook.office365.com)
parameters:
- name: username
description: The SMTP login username
multiline: false
example: "frikky@shuffler.io"
required: true
schema:
type: string
- name: password
description: The password to log in with SMTP
multiline: false
example: "******************"
required: true
schema:
type: string
- name: imap_server
description: The imap server host
multiline: false
example: "Outlook.office365.com"
required: true
schema:
type: string
- name: foldername
description: The folder to use, e.g. "inbox"
multiline: false
example: "inbox"
required: true
schema:
type: string
- name: amount
description: Amount of emails to retrieve
multiline: false
example: "10"
required: true
schema:
type: string
- name: unread
description: Retrieve just unread emails
multiline: false
options:
- "false"
- "true"
required: true
schema:
type: bool
- name: fields
description: Comma separated list of fields to be exported
multiline: false
example: "body, header.subject, header.header.message-id"
required: false
schema:
type: string
- name: include_raw_body
description: Include raw body in email export
multiline: false
options:
- "true"
- "false"
required: true
schema:
type: bool
- name: include_attachment_data
description: Include raw attachments in email export
multiline: false
options:
- "false"
- "true"
required: true
schema:
type: bool
- name: upload_email_shuffle
description: Upload email in shuffle, return uid
multiline: false
options:
- "false"
- "true"
required: true
schema:
type: bool
- name: upload_attachments_shuffle
description: Upload attachments in shuffle, return uids
multiline: false
options:
- "false"
- "true"
required: true
schema:
type: bool
- name: ssl_verify
description: Whether to use TLS or not
example: "true"
required: false
options:
- true
- false
schema:
type: string
- name: mark_as_read
description: Mark email as read or not
multiline: false
options:
- "false"
- "true"
required: false
schema:
type: bool
- name: parse_email_file
description: Takes a file from shuffle and analyzes it if it's a valid .eml or .msg
parameters:
- name: file_id
description: file id
required: true
multiline: true
example: 'adf5e3d0fd85633be17004735a0a119e'
schema:
type: string
- name: extract_attachments
description: Whether to extract the attachments straight into files
required: true
options:
- true
- false
example: 'true'
schema:
type: string
- name: parse_email_headers
description:
parameters:
- name: email_headers
description: Email headers
required: true
multiline: true
example: 'Email Headers'
schema:
type: string
returns:
schema:
type: string
- name: analyze_headers
description:
parameters:
- name: headers
description: Email headers in any format
required: true
multiline: true
schema:
type: string
returns:
schema:
type: string
large_image: data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/hAytodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL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DeiSB9D2lkbiqw4JEO58CrUQAdJV4pPkHu+sIpxDZ0Lm3ZdQ4tti6U/CFJKiVKUFle5Sk8HR5U8jBcghWoAgaArwSPIfe9Y8PnJkvl1nzgScy7zMoDVQpMyLtlXZekHfmvNucULHgR8DcEiIZtqro1s58gZucxFg6QmsbYJQVOonpFkqnJNrw9pYTcgAfSJuk8Tp4Qz9SSklKgQQbEHwgggjYeTOz9m7n/iFGHMq8Fz1YdCgJiZSjRKSiT8955XYQB6m58AYmN2LejtwJsyoYxri52XxVmC43unA3/ZpAEb0ygVvv4F09ojgEgm7wSSq5Kgsr3KUODo8qeRguQQrUAQNAV4JHkPvesKl1bY0Im2pdI4NuC6k/GENwVagAQO0EcEjmj1g33AATe1wD3SnmffgG/Tp337mv535T+EG4i4KiCbAnvE8j7kaHzf2Hdl/O1+YqONcraexU3jd6p0i8jNFfPU1ZLnxWlUNjxL0LOTs6+tzC+bWLKSkHUWpmXl5xKR4BJAbJjD0/oTcEoeH1Uz5rbzfe0sUZlolH+pTigFelo3Nlr0UuyZgSYZn6vQ6zjKaQQpr6uz3yBI462WQhNvRVxDscMYVwvgujMYfwfh+n0Wly/ZZlJCVQw2k8tCABp9YypsL6iQAe0U8Unkj3YDcE6gAQO0EcEjmj3oN9wAE3tcA90p5n34VIcUm7bUutPgp7vn4wOpS05MNtiyZdAW0PKo+MASkuIbIulbPXKHNfOEa+V9m6zf7Vq633rcIpSoqbQ6T2lvdQo80coVxRbRMLRuVLuBts+VJ4iKnEhtb6ECwl0BxseVR8YAlJcQ2RdK2euUOa+cI18r7N1m/wBq1db71uEUpUVNodJ7S3uoUeaOUK4otomFo3Kl3A22fKk8RFTiQ2t9CBYS6A42PKo+MASkuIbIulbPXKHNfOPtKSkvNy6JiYaC3F71KJO+P//Z
8 changes: 8 additions & 0 deletions email/1.3.0/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
requests==2.25.1
glom==20.11.0
eml-parser==1.17.0
msg-parser==1.2.0
mail-parser==3.15.0
extract-msg==0.30.9
jsonpickle==2.0.0

Loading

0 comments on commit 1f2e41b

Please sign in to comment.