SMTP_PyPi_Package
- SMTP Helper functions. Only uses Standard Library.
email_without_attachment: Send email without attachments.
def email_without_attachment(message: str, subject: str, to_list: str, cc_list: str, login: str, password: str):
"""
:param message: HTML String with Email message contained. See Examples/Email_Strings.py
:param subject: Subject String
:param to_list: Semicolon separated list of email addresses. (ex - a@abc.com; b@abc.com; c@abc.com;)
:param cc_list: Semicolon separated list of email addresses. (ex - a@abc.com; b@abc.com; c@abc.com;)
:param login: Login email.
:param password: Password for O365
"""
Example Call
from smtputility import email_without_attachment
test_message = """
<HTML>
<BODY>
Message Text
<br>
</BODY>
</HTML>
"""
email_without_attachment(test_message,'SMTP Testing','a@abc.com;b@abc.com;','c@abc.com','email@domain.com','password')
email_with_attachments: Send email with attachments. Can send any number/type of attachments in email.
def email_with_attachments(
message: str, subject: str, to_list: str, cc_list: str, login: str, password: str, *args
):
"""
:param login: Login email.
:param password: Password for O365.
:param message: HTML String with Email message contained. See Examples/Email_Body.html.
:param subject: Subject String
:param to_list: Semicolon separated list of email addresses. (ex - a@abc.com; b@abc.com; c@abc.com;)
:param cc_list: Semicolon separated list of email addresses. (ex - a@abc.com; b@abc.com; c@abc.com;)
:param *args: Paths to attachments.
"""
Example Call
from smtputility import email_with_attachments
test_message = """
<HTML>
<BODY>
Message Text
<br>
</BODY>
</HTML>
"""
email_with_attachments(test_message,'SMTP Testing','a@abc.com;b@abc.com;','c@abc.com','email@domain.com','password',
r'C:\Users\user\some_directory\test_1.txt')
notify_error: Automated email report for use in exception catch.
def notify_error(report_name, error_log, to_list: str,login: str, password: str):
"""
:param to_list: List of emails to receive notification.
:param report_name: Name of automated report.
:param error_log: Raised exception or other error to report.
:param login: Login email.
:param password: Password for O365
"""
Example Call
from smtputility import notify_error
import os
def foo():
raise Exception('Error!')
try:
foo()
except Exception as e:
notify_error(f"{os.path.basename(__file__)}", e, "a@email.com",'email@domain.com','password')
notify_error: Automated email report for use in exception catch.
def default_table_style(df, index: False):
""" Apply a default clean table style to pandas df.to_html() for use in email strings.
:param index: Determines whether you want index displayed in the HTML. Defaults to False.
:type index: Boolean
:param df: Dataframe to apply the style to.
:type df: Pandas Dataframe
:return: HTML string for insertion in email.
:rtype: string
"""
Example Call
from smtputility import default_table_style
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0,100,size=(15, 4)), columns=list('ABCD'))
test_message = f"""
<HTML>
<BODY>
{default_table_style(df,index=False)}
<br>
</BODY>
</HTML>
"""
Metadata
Release files for smtputility 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smtputility-1.3.tar.gz | 3.9 kB | Without provenance | Details for smtputility-1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smtputility-1.3-py3-none-any.whl | Python 3 | none | any | Details for smtputility-1.3-py3-none-any.whl |
Total release size: 10.4 kB
Release files / smtputility-1.3.tar.gz
| Download URL | smtputility-1.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c6aebfdb4bd1de1ada1165783bc79f3ce3fc8203cfc79a11293bdd4b1b950f0
|
|
BLAKE2b-256 checksum How to use checksums |
2300ace6abfc3f5267c1b48fa706b5301f978fa1257b809d1251c6bf7d06857d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Release files / smtputility-1.3-py3-none-any.whl
| Download URL | smtputility-1.3-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b060d39c5993fd4d83fb982275170c0e9ab9560789912f04ed2442fb985926c3
|
|
BLAKE2b-256 checksum How to use checksums |
fa9cbcba71c155893ec597bce7a9e2aa05047ffc0ea1a05de84838cd95fd2e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Security for smtputility 1.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.