Git Product home page Git Product logo

emailnotificationlambda's Introduction

Email Alert Add-On

What is Email Alert Add-On

Email Alert Add-on is an automated alert that is fired when a file is uploaded to a source cloud storage location in AWS, Azure, and GCP.

How it works

When files are uploaded to the source cloud storage location, an event is used to trigger the Email Alert add-on, which sends an SMTP message.

Instructions for Use and Deployment

Requirements

Environment setup

  1. run pipenv install -r src/provider/requirements.txt
  2. run pipenv lock && pipenv sync

Updating python version

  1. Update required:python_version in Pipfile to "3.9"
  2. run pipenv install --python=python3.9

Updating dependencies

To unpin dependencies and allow them to be updated

  1. modify dependency version in pipfile from ==x.x.x to >=x.x.x
  2. run pipenv update

To pin dependencies into a non-updatable state

  1. run pipenv run freeze > src/requirements.txt
  2. run pipenv install -r src/requriement.txt

Shared Module

All cloud providers use the src/main/res/ module and its contents for sending emails. Before deploying to any cloud provider you should copy the contents of the res directory into the provider specific res directory.

Customize Emails

The add-on uses the src/main/res/email.html and src/main/res/email.txt files as templates for the emails it sends. The html file is the main representation while the txt file is the non-html backup. In order to send custom emails, edit or replace the email.html and email.txt files with the template you want.

At runtime, the program will substitute some values in as follows (without the quotation marks):

  • "{PROVIDER}": Cloud provider that received the file.
  • "{LOCATION}": Bucket or container that the file is in. On Azure this is the storage account followed by the container. EX: "{storage account}/{container name}"
  • "{FILEPATH}": Filepath of remote file (including folders). EX: users/user1/testfile.txt
  • "{DIRECTORY}": Directory of the remote file. EX: users/user1
  • "{FILENAME}": Filename of remote file (excluding folders). EX: testfile.txt
  • "{SIZE}": Size of uploaded file
  • "{HASH}": MD5 hash of uploaded file
  • "{LOCATION_TYPE}": "Container" on Azure, "Bucket" otherwise.
  • "{USER}": Name of user folder that was uploaded to. EX: If uploaded to users/user1/..., {USER} substitutes to "user1".

Azure only substitutions:

  • "{STORAGE_ACCOUNT}": Name of storage account that is uploaded to.
  • "{CONTAINER}": Name of container that is uploaded to.

AWS and GCP only substitutions:

  • "{BUCKET}": Name of bucket that is uploaded to. (Alias of {LOCATION} substitution)

In the event that a substitution cannot be found, no error is raised and the text is left alone. These substitutions are done with str.replace() so no functions can be run through it.

emailnotificationlambda's People

Contributors

cgick avatar

Watchers

Jeff Thorn avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.