Skip to main content

Command-line SMTP email sending tool in Python

Project description

MasterUpdate

littlemail

Littlemail is a straight-forward command-line SMTP email sending tool in Python, which sends one email per command. (If you send many emails, every sending will make a new connection with the smtp server.)

Installation

$ pip install littlemail

Usage

There is no way to reduce parameters provided in command-line, since that's the way of email. So, please refer to the inline help for options you need. Fortunately, many options have default value.

$ python -m littlemail -h  # inline help

Anyway, here is a minimal example and a few lines of explanation:

$ python -m littlemail -s test [-c hello] \
                -f 12345@qq.com \
                --to 54321@qq.com \
                --smtp smtp.qq.com [-p abcdefg]

-c means the email content, which is optional. That means you can send empty-content email. And this optional parameter enables the capability of littlemail to get content from pipe (input redirection), which might be easier for you to construct your message, such as:

$ python -m littlemail <...> < my_email_content.txt

-s represents subject, which is mandatory and cannot be empty.

-p stands for password, and it is optional. When it's missing, littlemail tries to get password from LITTLEMAIL_PASSWD environment variable.

When something goes wrong, try --debug.

API

There is an API you can invoke to send email in your code:

# import
from littlemail import send_email
# signature
send_email(subject: str,
           *,
           text: str = '',
           contype: str = 'plain',
           alist: list[str] = [],
           to: list[str],
           cc: list[str] = [],
           bcc: list[str] = [],
           fromaddr: str,
           smtp: str,
           port: int = 587,
           timeout: int = 3,
           protocol: str = 'tls',
           passwd: str|None,
           debug: bool = False) -> None

api_test.py is used as an example and testcase for you try, have fun! ^___^

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

littlemail-0.32.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

littlemail-0.32-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file littlemail-0.32.tar.gz.

File metadata

  • Download URL: littlemail-0.32.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.3

File hashes

Hashes for littlemail-0.32.tar.gz
Algorithm Hash digest
SHA256 67b5e0229cd23a288ed5a78420631bfac29815ef4167adc4f3b9fa4d3d9787b9
MD5 eac68b8a8d705f4293101abe18535888
BLAKE2b-256 668a3de8ca9ce35aa6cda069785601e5551b8acdbc00ed884e57d11cceb898c0

See more details on using hashes here.

File details

Details for the file littlemail-0.32-py3-none-any.whl.

File metadata

  • Download URL: littlemail-0.32-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.3

File hashes

Hashes for littlemail-0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 784eaafe92ec20f0b8cc9310824f31542f099dbba391ab9c4d8030b4c623e870
MD5 a28254d2d1ed30911e66022ef265e253
BLAKE2b-256 c7019200bec6c744273b31e115aa1cc6b187aa8cc7a0432e92119999df257503

See more details on using hashes here.

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