Skip to content

UBC-LFS/lfs-mass-mailer-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LFS Mass Mailer (flask)

An application to send mass emails via aliases, used internally by the LFS Learning Centre.

Note: Logging in with your CWL and password only works if you are connected to a UBC wifi. This means would need to be connected to UBC wifi in order to use this application

Prerequisites

  1. Install Python 3.7 or greater.
  2. Install Git.

Installing and Setup

Clone this repo:

git clone https://github.com/UBC-LFS/lfs-mass-mailer-flask.git

Set up your virtual environment

pip install virtualenv
virtualenv venv
venv\Scripts\activate
pip install -r requirements.txt

Create a .env file and specify the following with quotes:

# LDAP
LDAP_URI=
LDAP_MEMBER_DN=
LDAP_AUTH_DN=
LDAP_AUTH_PASSWORD=
LDAP_SEARCH_FILTER=

# "smtp.mail.ubc.ca" OR "smtp.mail-relay.ubc.ca"
EMAIL_HOST=
# Sender's email (smtp option) or alias name(smtpRelay option)
ACCOUNT_USER=
# password only for smtp option
ACCOUNT_PASS=
# Alias email for smtpRelay option
ALIAS_EMAIL=
# "smtp" (default) OR "smtpRelay"
TRANSPORTER_OPTIONS=

Running the website

  1. Run main.py
python main.py
  1. Go to: http://127.0.0.1:5000/ (localhost)
  2. Login with your CWL and Password (only works with UBC wifi)
  3. Upload a .csv file containing at least a "Email" column then click "submit"
    • A template .csv file can be found here
    • The first 10 rows will be displayed
  4. Scroll down and begin writing your email
    • You can insert variables into your email from your spreadsheet by surrounding it %, capitalizing it, and replacing spaces with underlines
  5. Preview your email by clicking on the preview button
    • If you inserted variables, their values will be the values in the first row
  6. Send your email(s)
  7. A summary page will appear when all emails are sent. It will notify you of which emails were sent and which could not be sent.

What each file does? (For future developers)

  • main.py
    • runs the web server
    • validates LDAP logins
    • formats data sent from the frontend
    • sends results back to frontend
    • logs out user
  • sendEmail.py
    • code for sending out emails and formatting recipients data
  • templates
    • index.html
      • Contains HTML code for the website elements
      • Contains JS code for:
        • creating the email preview + other pop ups
        • sending login info to the backend for validation
        • sending content to be emailed to the backend
    • footer.html (the website's footer)
    • navigationbar.html (the website's navigation bar)
  • static
    • css (contains css files that style index.html and the navigation bar + footer)
    • javascript
      • createPreview.js
        • renders the email preview pop up
        • renders the email summary pop up (shows successful and unsuccessful emails sent)
      • login.js
        • saves users login auth status and sessionID
        • detect form "enter" events
        • logs out user
      • uploadTable.js
        • process uploaded .csv file and displays table rows and summary
    • richtexteditor (the richtexteditor library - no need to modify this folder)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published