Giter VIP home page Giter VIP logo

pyagmail

A python script that use gmail and csv file to send email to lists

┏━┓╋╋╋╋╋╋╋╋╋╋╋╋┏┓
┃╋┣┳┳━┓┏━┳━━┳━┓┣╋┓
┃┏┫┃┃╋┗┫╋┃┃┃┃╋┗┫┃┗┓
┗┛┣┓┣━━╋┓┣┻┻┻━━┻┻━┛
╋╋┗━┛╋╋┗━┛

Prerequisites

You need to allow the sender gmail account to use unsecure app via:

https://support.google.com/cloudidentity/answer/6260879?hl=en

Or setup the script and yagmail to use OAuth2 autorization:

https://yagmail.readthedocs.io/en/latest/setup.html#installing-from-pypi

(maibe) Build animation package

Usage

Works with python 2.7, not tested with python3.

The scripts require some pyton packages (pip install package-name):

Start the script

  • Create a email-list.csv file

In this file, will be read the email list to which to send the emails, for each line a different email, the script will scan this file, line by line, and send the emails to each address read. the first line of the file is not read by the script (you can name as you wish, remember to put the same name into config.py file and put in the same path of the project and use .csv extension).

  • Create a filename-of-the-body.txt file:

This file contain the body of the email you need to use the right encode.

For me, the solution of using a txt file worked well, in the sense that for special characters I didn't have to make any changes for the encoding problems, the example txt file is the original one, without modifications, that I used for send emails, I use the plain text format and not the HTML format, which I have not tested yet.

This file contain the body of the email you need to use the right encode, to be read correctly by the python interpreter, in this file there are some reference links and documentation to understand the problem (you can name as you wish, remember to put the same name into config.py file and put in the same path of the project and use .txt extension).

  • Edit the file config.py all entered values must be contained in quotes '' (apart timer field, it don't need '') :
email = {'subject': 'Put here the email subject',
        'body': 'filename-of-the-body.txt',
        'email': '[email protected]',
        'passwd': 'SenderPassword',
        'timer': 100,
        'file': 'email-list.csv',
        'log_email': '[email protected]'}

The timer field is the time expressed in seconds between sending an email and the other, the value 100 is about 2 minutes.

  • Run for 1 time the keyring-registration.py file set the same password of your sender email password:
python keyring-registration.py

This will store into linux keyring system the yagmail autorization to use and run the machine.

  • Run the pyagmail.py script to start sending mail:
python pyagmail.py

launching the script you will need to leave the terminal window open to complete it, otherwise it will stop.

Since, depending on the length of the list, the execution of the script may take days, to overcome the problem of keeping the terminal open, if you use linux, you can take advantage of tmux to launch the script in the background:

Some solution to run in background with windows:

To Do

  • Loading ideas...
  • Build setup file
  • Implementing OAut2 for gmail secure apps
  • Made plain and html version of the emails
  • Set digital signature to emails in gmail
  • Adding animation when script is runnig
  • Configuring keyring
  • Set google account to operate with in less security apps (google account option option security)
  • Set autoreply message in gmail to tell users where can contact you (using gmail account settings to do this)

Used resouces

Usefull resources:

Gmail stats

To do

  • Loading...
┏━━┳┓╋╋╋╋╋╋┏┓┏━┓
┗┓┏┫┗┳━┓┏━┳┫┣┫━┫
╋┃┃┃┃┃╋┗┫┃┃┃━╋━┃
╋┗┛┗┻┻━━┻┻━┻┻┻━┛

┏━━━┓
┃┏━━┛
┃┗━━┳━━┳━┓┏┓┏┳━━┳┳━┓┏━━┓
┃┏━━┫┏┓┃┏┛┃┃┃┃━━╋┫┏┓┫┏┓┃
┃┃╋╋┃┗┛┃┃╋┃┗┛┣━━┃┃┃┃┃┗┛┃
┗┛╋╋┗━━┻┛╋┗━━┻━━┻┻┛┗┻━┓┃
╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋┏━┛┃
╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋╋┗━━┛

┏━┓╋╋╋╋╋╋╋╋╋╋╋╋┏┓
┃╋┣┳┳━┓┏━┳━━┳━┓┣╋┓
┃┏┫┃┃╋┗┫╋┃┃┃┃╋┗┫┃┗┓
┗┛┣┓┣━━╋┓┣┻┻┻━━┻┻━┛
╋╋┗━┛╋╋┗━┛

Pyagmail's Projects

Pyagmail doesn’t have any public repositories yet.

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.