Skip to main content

Mail1 is an API to send email with a single function call. For instance, we could send an email running:

import mail1

mail1.send(subject='Test',
           text='This is a test!',
           recipients='casa@sweetohm.net',
           sender='casa@sweetohm.net',
           smtp_host='smtp.orange.fr')

That’s it!

send() method

The signature of the method to send an email is the following:

send(subject, text, text_html=None, sender=None,
     recipients=[None], cc=[], bcc=[], attachments={},
     smtp_host=SMTP_HOST, smtp_port=SMTP_PORT,
     encoding=ENCODING)

The parameters are the following:

  • subject: this is the subject of the email, as a string.

  • text: this is the text of the email as a string.

  • text_html: text as HTML.

  • sender: email address of the sender of the email.

  • recipients: the list of recipients, or the recipient as a string if there is a single one.

  • cc: the list of carbon copies.

  • bcc: the list of blind carbon copies.

  • attachments: a dictionnary that gives the file name for a given attachment name.

  • smtp_host: the hostname of the email server.

  • smtp_port: the port of the email server (defaults to 25).

  • encoding: the encoding of the message.

Command line

You can also invoke this script on command line to send emails. To get help about command line parameters, type mail1 -h, which will display following help page:

mail1 [-h] -f from -r recipient -s subject -a file
           -m smtphost -e encoding message
Send an email with following:
-h            Print this help page
-f from       The mail sender
-r recipient  The mail recipient(s)
-s subject    The mail subject
-a file       A file to attach
-m smtphost   The SMTP server host
-e encoding   The encoding to use
message       The message

Enjoy!

Metadata

Release files for mail1 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mail1 0.2.0
File Size Uploaded Provenance
mail1-0.2.0.tar.gz 6.8 kB Without provenance Details

Release files / mail1-0.2.0.tar.gz

Download URL mail1-0.2.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca4ccebbf539452bd84d3baacfd0b51e62c562da2dd6d740e49d1cc5cf434848
BLAKE2b-256 checksum
How to use checksums
d380c31bbaef139c87d91a6aa8f241c7279a757e1946e9d67ec6e6ad0e34af98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for mail1 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page