Skip to main content

BeautifulEmail is a python package that makes it easy and quick to save pandas dataframes in beautifully formatted excel files. BeautifulEmail is the Openpyxl for Data Scientists with a deadline.

Project description

BeautifulEmail

⚠️🏗️️ Note: This is only the first version - actively working on additional features!

BeautifulEmail is a python package that makes it easy and quick to send beautifully formatted emails with beuatiful tables/dataframes. BeautifulEmail is for Data Scientists with a deadline.

Email Example:

Email Preview

Getting it

$ pip install beautifulemail

Update Package: (execute regularly to get the latest features)

$ pip install beautifulemail --upgrade

How to use:

from beautifulemail import Connection, DataFrameToHTML

df_styled = ...

df_html = DataFrameToHTML(df=df_styled)

# format numbers automatically 
df_html.col_num_fmt_auto()

# add background styling to columns
df_html.col_styles(column=['last_contact', 'revenue'], classes=['bg_light_blue'])
df_html.col_styles(column=['last_contact'], classes=['text_color_amber'])

# use markdown to write email - more infoss here: www.markdownguide.org/cheat-sheet/
email_body_markdown = f"""
Hi,

This is a test email with **bold text**, *italic text*, ~~strikethrough text~~, <mark>highlited text</mark>, [hyperlink text](https://www.google.com), and text that could be footnoted<note>[1]</note>.

# This would be a Heading 1 of an ordered list

1. First step
2. Second step
3. Third step

{df_html}

Embedded image:
<img src="cid:image1" style="width: 100px;">

Best wishes,
Me
    """

    # connect to email server
    with Connection(host='smtp.gmail.com', port=465, ssl=True, user='myemai@gmail.com', password='my_password') as conn:
        # send email
        status = conn.send_email(
            from_='my_emai@gmail.com',
            to_=['your_emai@gmail.com', 'second_emai@gmail.com'],
            subject='Email Subject',
            body_markdown=email_body_markdown,
            attachments=['./README.md'],
            embedded_imgs=['./email_preview.jpg'],
            dry_run=False
            )
        
        # status contains all the email information including the html body
        print('Email sent:', status)

        # save sent email documntation/summary as excel
        conn.save_sent_email_summary('sent_emails.xlsx')



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

beautifulemail-0.1.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beautifulemail-0.1.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file beautifulemail-0.1.2.tar.gz.

File metadata

  • Download URL: beautifulemail-0.1.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for beautifulemail-0.1.2.tar.gz
Algorithm Hash digest
SHA256 20f0b065efa6e27792d3ad83ec69650fac3f7b0bc4e25959c1d2d77722cc1ca3
MD5 fe56c773092a73ee396d303c14d56d4b
BLAKE2b-256 90bfad32ad5390f82ed9db7743adb9953f08b01f1aaa8a66db4be7b819da9dc6

See more details on using hashes here.

File details

Details for the file beautifulemail-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: beautifulemail-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for beautifulemail-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29ac4045b105506efff8d26d279b5be4616bcd2a8a483809246e28ba32d8bf0e
MD5 62813733695e53e2f8af1abce4af0f22
BLAKE2b-256 b3315d09a9df655bdd8081aa53aadee16688e1ad3d96669583a71fe51d5e5290

See more details on using hashes here.

Supported by

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