Skip to main content

this is dvsnier email.

Project description

README

this is a simple email sending program, providing two ways: SMTP and SMTP SSL abstract modules with dev version.

One. preconditions

  • only plain text email is supported

Two. the email config

the please create a new conf folder in the current project directory, Then create a new email_config.cfg or email_ssl_config.cfg file

- this your project root
| - .
| - ..
| + conf
|    - email_config.cfg         // smtp config files
|    - email_ssl_config.cfg     // smtp ssl config files
|
| + src
|    + ...
|
| + tests
|    + ...
|
| - .gitignore
| - LICENSE.txt
| - MANIIFEST.in
| - pyproject.toml
| - README.md
| - setup.cfg
| - setup.py
| - tox.ini
| ...

since the conf folder contains private information, please add the directory to the .gitignore file.

2.1 smtp config

# set up server
mail_host = smtp.xxx.com
# server default port that is 25
mail_port = 25
# user name
mail_user = xxx@gmail.com
# password
mail_pass = your_password_or_token
# sender
mail_sender = xxx@gmail.com
sender_alias = sender_alias
# receiver
mail_receiver = yyy@163.com
receiver_alias = receiver_alias

2.2 smtp ssl config

# set up server
mail_host = smtp.xxx.com
# server default port that is 465/994
mail_port = 465
# user name
mail_user = xxx@gmail.com
# password
mail_pass = your_password_or_token
# sender
mail_sender = xxx@gmail.com
sender_alias = sender_alias
# receiver
mail_receiver = yyy@163.com
receiver_alias = receiver_alias

Three. usage

# -*- coding:utf-8 -*-

from com.dvsnier.email.email import Email

email = Email()
# smtp cfg file
email.config_file('conf/email_config.cfg')
# smtp ssl cfg file
# email.config_file('conf/email_ssl_config.cfg')

# true is smtp ssl way, otherwise smtp
email.init(True)
# email.init()

email.builderText('subject', 'content')
email.sendmail()
email.quit()

Four. explain

since it is only a development version, only text mode is provided at present, and the attachment of multimedia mode is supported in the future

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

com.dvsnier.email-0.0.1.dev1.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distribution

com.dvsnier.email-0.0.1.dev1-py2.py3-none-any.whl (16.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page