Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloPhagula committed Jan 12, 2017
0 parents commit acbf2a7
Show file tree
Hide file tree
Showing 13 changed files with 605 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file is for unifying the coding style for different editors and IDEs
# @see http://editorconfig.org

# This is the top-most .editconfig file; do not search in parent directories
root = true

# Default settings:
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
max_line_length = 80

[{*.txt}]
end_of_line = crlf

[*.sh]
end_of_line = lf

[*.{cmd, bat}]
end_of_line = crlf

[*.md, *.diff]
trim_trailing_whitespace = false

[{*.json, *.yml, *.xml, *.eslintrc, *.csslintrc, *.html}]
indent_style = space
indent_size = 2

[*.sql, *.sh]
max_line_length =
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Email / SMTP
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=smtp_username
SMTP_PASSWORD=smtp_password
111 changes: 111 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Folder view configuration files
.DS_Store
Desktop.ini

# Thumbnail cache files
._*
Thumbs.db

# Files that might appear on external disks
.Spotlight-V100
.Trashes

# NetBeans project folder
nbproject
.idea

*.sw[po]
*.un~
*.*~
dump.rdb
.foreverignore
.*.gz

# Python byte-compiled / optimized / DLL files
*.py[cod]
*$py.class
__pycache__

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Flask instance folder
instance/

#temp files
temp_cache*.xml
temp_cache*.html

#sqlite
*.db

# dotenv
**/.env
**/.env.*
**/env.ini
!**/.env.example
!**/env.ini.example
**/env
**/lib

# virtualenv
venv/

# Google App Engine generated folder
appengine-generated/

# With version 1.8.2 of git, you can also use the ** wildcard to match any level of subdirectories:
**/vendor
**/bower_components
**/node_modules
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

For a complete view of all the releases, visit the releases page on GitHub:
[https://github.com/dareenzo/send_mail/releases](https://github.com/dareenzo/send_mail/releases)

## v0.1.0 - 2017-01-12

- Initial release
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2017, Paulo Phagula <pphagula@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README.md LICENSE CHANGELOG.md requirements.txt

recursive-exclude * __pycache__
recursive-exclude * *.py[co]

57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# send_mail

Email sending module for scripts.

## Usage

Put `SMTP_HOST, SMTP_PORT, SMTP_USE_TLS, SMTP_USERNAME & SMTP_PASSWORD`
in environment variables so module can pick up or pass them as
keyword arguments dropping the *smpt_* prefix.

```python
HTML_EMAIL = """
<html>...
</html>
"""

PLAINTEXT_EMAIL = """
Yo...
"""

send_mail(
[('To Example', 'to@example.com'), 'you@example.com'],
'[AwesomeApp] very descriptive subject',
HTML_EMAIL,
is_html=True,
cc='him@example.com, her@example.com',
bcc=['them@example.com', ('You Know Who', 'youknowwho@example.com')],
sender=('AwesomeApp', 'notifications@example.com'),
reply_to='no-reply@example.com',
attachments=['/full/path/to/attachment.ext']
)

send_mail(
[('To Example', 'to@example.com'), 'you@example.com'],
'[Mail Test] I should be delivered to the inbox',
PLAINTEXT_EMAIL,
is_html=False,
cc='him@example.com, her@example.com',
bcc=['them@example.com', ('You Know Who', 'youknowwho@example.com')],
sender=('App', 'notifications@example.com'),
reply_to='no-reply@example.com',
attachments=['/full/path/to/attachment.ext', '/full/path/to/attachment.ext'],
host="smtp.provider.org",
port=25,
username="username",
password="****",
use_tls=True
)
```

## Testing

```sh
cp .env.example .env
# edit .env file with your mail settings
tox
```
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
html2text==2016.9.19
six==1.10.0
Loading

0 comments on commit acbf2a7

Please sign in to comment.