Skip to main content

Python Pkg for sending autmated reports on email

Project description

mailreport

Python package for
  • Sending autmoated mails in CSV/XLSX/TXT/HTML/EMAIL-BODY/HYPERLINKS formats.

mailreport is a data module which is used for sending simple automated reports via mail.

Installation

mailreport requires below packages dependencies: pandas, psycopg2, smtplib, email.mime.text, email.mime.multipart

Installation Commands

To install the latest Pypi version, you’ll need to execute:

    pip install mailreport
    or
    python3 -m pip install mailreport

If instead you want to install the latest github master version:

    git clone https://github.com/nit567esh/mailreport.git
    cd <pkg_directory>
    python3 setup.py install

Usages

Functions: Two functions can be used in this module

- makeoutput: A user can pass different output format and report will be prepared as per provided format. Available formats are CSV/TXT/XLSX/HTML/HTML-TEXT/HYPERLINK. 
- sendmail: A user can send mail to target receptionist using this module by attaching files/HTML text/Hyperlinks/Normal text ext. 

1. Send CSV(s)/TXT(s) Report

>>> import mailreport as mr
>>> df_list = list(dataframe1, dataframe2)
>>> mr.makeoutput(format_type='csv', df_list=[df_list[0], df_list[1]], file_list=['name1.csv','name2.csv'])
>>> sendmail(mailserver='gmail', 
    email='xxxxx@gmail.com',
    password = 'XXXX23CCVVXX',
    to = ['xxxxxx@gmail.com'],
    cc = None, 
    bcc = None, 
    subject = 'Updated Report XXXXX', 
    message = None, 
    messageHTML = "<html><html><body><p><b>Hi All,</b><br><br>Below is the attached updated report.<br><br><b>Regards,</b><b><br>Team Name</b></p></body></html>", 
    files = ['name1.csv','name2.csv'])

2. Send EXCEL(.XLSX) Report

>>> import mailreport as mr
>>> df_list = list(dataframe1, dataframe2)
>>> mr.makeoutput(format_type='xlsx', df_list=[df_list[0],df_list[1]], workbook_name='name.xlsx', sheet_list = ['XXXX','YYYY'])
>>> sendmail(mailserver='gmail', 
    email='xxxx@gmail.com',
    password = 'XXXX23CCVVXX',
    to = ['xxxxx@gmail.com'],
    cc = None, 
    bcc = None, 
    subject = 'Updated Report XXXXX', 
    message = None, 
    messageHTML = "<html><html><body><p><b>Hi All,</b><br><br>Below is the attached updated report.<br><br><b>Regards,</b><b><br>Team Name</b></p></body></html>", 
    files = ['name.xlsx'])

2. Send More advance report i.e one import dataframe to email body(html text) & other as csv attachment

>>> import mailreport as mr
>>> df_list = list(dataframe1, dataframe2))
>>> mr.makeoutput(format_type='csv', df_list=[df_list[0]], file_list=['name1.csv'])
>>> df_as_html = mr.makeoutput(format_type='html_text', df_list=[df_list[1]])
>>> sendmail(mailserver='gmail', 
    email='xxxxxx@gmail.com',
    password = 'XXXX23CCVVXX',
    to = ['xxxxxxx@gmail.com'],
    cc = None, 
    bcc = None, 
    subject = 'Updated Report XXXXX', 
    message = None, 
    messageHTML = str("<html><html><body><p><b>Hi All,</b><br><br>Below is the attached updated report.<br>")+str(df_as_html)+str("<br><b>Regards,</b><b><br>Team Name</b></p></body></html>"), 
    files = ['name1.xlsx'])

Note -

  • We can only use csv/html_text/htmlfile/xlsx as format_type.

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

mailreport-1.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

mailreport-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file mailreport-1.0.1.tar.gz.

File metadata

  • Download URL: mailreport-1.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for mailreport-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b6d4fb6f759479d3544f7cec189d993b191cbc289d2711876b157079ec821be9
MD5 8975d1f67d7d007e9999e176c87167ba
BLAKE2b-256 036e8266adedd13a45e2822ce75228362e84c7231383f7d840bba53726e29ad3

See more details on using hashes here.

File details

Details for the file mailreport-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mailreport-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for mailreport-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 785a29f7d5f0bb5da7b7ca46185ceb895c1f919af6c7a0b2dab7cc5f72626f95
MD5 626c0a6806c0be661ffdb9ef05be1181
BLAKE2b-256 39a80b53bffac29d4d3112614e01147cec1eb230aaaf4455945ed2f0e4041477

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