Easy mail sending using Python3
$> cd <your_folder>
$> git clone https://github.com/pBouillon/easy_mail.git
$> cd easy_mail
$> python3 setup.py install
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')
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')
README.md
made with the help of this websitesetup.py
made with the help of this repository
Contributions are welcome