Skip to content
This repository has been archived by the owner on Aug 7, 2018. It is now read-only.

pBouillon/easy_mail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📧 📪 Easy mail sending using Python

Easy mail sending using Python3

Installation

$> cd <your_folder>
$> git clone https://github.com/pBouillon/easy_mail.git
$> cd easy_mail
$> python3 setup.py install

Usage

Without configuration file

From your program, do the following:

import easy_mail
from easy_mail import Email

if __name__ == '__main__':
    header  = 'My mail header'
    message = 'This is my mail, sent with Python'

    mail = Email('sender@mail.com', 'receiver@mail.com')
    mail.prepare(header, message[, type])
    mail.send('smtp.server.addr', 'login@mail.com', 'password')

With a configuration file

Define all fields in a .json file:

{
    "header"  : "Python3 mail",
    "content" : "This mail is sent with Python3",
    "type"    : "plain",

    "login"     : "",
    "password"  : "",
    "smtp_addr" : "",

    "receiver": "",
    "sender"  : ""
}

Then, just use the class method send_from_source_file(<path>) and specify the path as:

import easy_mail
from easy_mail import Email

if __name__ == '__main__':
    Email.send_from_source_file('my/custom/path/myfile.json')

Other

Contributions are welcome

About

📧 📪 Easy mail sending using Python3

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages