Send mail from gmail using python
Project description
Description
This is a very simple package that enables you to send mail through gmail using python. It’s not a big deal, it does not read your emails, no calendars, no drafts… It does just one thing, sending emails.
Requirements
Python 3
pip3 for installation
Install
Using setup.py
git clone https://github.com/kindlychung/pygmail.git cd pygmail python3 setup.py install
You can copy the gmailsend.py script to a folder in your $PATH, for example:
sudo cp bin/gmailsend.py /usr/local/bin/
Using pip:
From github:
pip3 install --upgrade git+https://github.com/kindlychung/pygmail.git
or from PyPI:
pip3 install --upgrade pygmail2
As far as I know pip will not take care of the script files in bin/.
Security
It uses smtp, that’s all. You can always check the source code, of course
Usage
From a interactive python shell or from any python file:
from pygmail2.Pygmail import Pygmail
Pygmail().send_mail('u@domain.net', 'hi, there', '<b>important stuff </b>')
Using the gmailsend.py in shell
gmailsend.py -h
usage: A python script for sending emails from commandline using gmail
[-h] [--subj SUBJ] [--body_file BODY_FILE] to_addr
positional arguments:
to_addr Recepient email address
optional arguments:
-h, --help show this help message and exit
--subj SUBJ, -s SUBJ Subject of the email
--body_file BODY_FILE, -b BODY_FILE
Write up your mail body in the shell in a interactive fashion:
gmailsend.py your@email.org -s hi_there
Pipe your mail body to the script:
echo "<b>hi, how are you?</b>" | gmailsend.py your@email.org -s hi_there
Load the mail body with a html file:
wget www.google.com -O body.html gmailsend.py your@email.org -s hi_there -b body.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pygmail2-0.2.3.tar.gz.
File metadata
- Download URL: pygmail2-0.2.3.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e713439a25487d1f2c9d7cf744fe95e59536ba46359e7215fda93a2e13efe4a
|
|
| MD5 |
20aeabc8f805949ff3a753b417ff2338
|
|
| BLAKE2b-256 |
6dc183a07965a58df133046241125d630fda8b7083bb5e5d4c33ae62793f7764
|