Code Monkey home page Code Monkey logo

diffusion-mailer's Introduction

Mailer

A client to send emails to multiple directions programatically using Python

Setup

  • Go into this link and click the button that reads "ENABLE THE GMAIL API", making sure to enter with the gmail account from which all the mails will be sent (this will create a project inside your google console, you want to remember the name. You can also change its name to your convenience).
  • Click the button that reads "DOWNLOAD CLIENT CONFIGURATION" and move the downloaded file to the root of this repository. Make sure that the file is named client_secret.json.
  • Inside the file parameters.py, replace the content of the variable MAIL_SENDER with the name of the gmail account from which all the mails will be sent and comment the last 2 lines.
  • Run the following command:
      python3 setup.py
  • If that mail is being used for the first time, a browser will open asking for permission to use extraordinary data from that Google Account. Agree to everything. It is possible that the browser blocks the connection thinking that it is fraudulent, in which case the browser should be gracefully ingnored.
  • If that mail had already been used, no browser will open. Either way, a mail will be sent to the account by itself.

Files Required

  • The script requires a file called mail_list.csv containing data of every target.
  • The script requires a file called template.txt which is a template for the mail which is going to be sent. The template can use each of the target's name, last name, mail or enterprise inside the body just placing, for example, {name} where you want the name to appear.
  • The repository contains a sample_mail_list.csv file and a sample_template.txt file for you to modify. Note that the file names MUST be mail_list.csv and template.txt.
  • The script won't work without the setup being completed and the file client_secret.json being in the repository.
  • If you want to send attachments, you must put them in a folder inside the root of the repository named attachments.

Usage

Once the setup is completed and every required file is added, to run the script all that is left is to run:

python3 main.py title

Where title will be the subject of the mails sent. Note that if title is ommited, the subject will be 'Sample Diffusion'.

You can also change most of the naming requirements inside the parameters.py file if you want to do so.

Considerations

  • The column which contains the mails to send the emails MUST be called mail by default, but it can be changed within parameters.py to match the specific database.
  • The csv format can be changed within parameters.py by changing the value DELIMITER for the separator and SKIPINITIALSPACE to specify an initial space after each delimiter.

diffusion-mailer's People

Contributors

daleal avatar

Watchers

 avatar

Forkers

ibamin

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.