Skip to main content

Send smtp mail

Project description

send_gmail

Python : Sending an email via smtp Server Default smpt Server : gmail

usage:

from send_gmail import SendGMail

html = '<html><body>Hello world </body></html>'
txt = 'Hello world as text'
subject = 'First message'
pdffile = r'c:\tmp\test.pdf'

smtpsrv = SendGMail(id='xxxx@gmail.com',pwd='977823490123')

"""
send

Args:
    from_addr (str | None): sender email, if None the id field is used   
    to_addr (list | str): receiver(s) email, string for one - list for many
    subject (str | None ): subject as utf-8 text, if None current date is send
    html (str, optional):html part of message. Defaults to None.
    text (str, optional): text part of message. Defaults to None.
    attachments (list | str, optional): files to attach. Defaults to None.

Returns:
    dict: dictionary of errors, key == to_addr, value == Error
"""

errs = smtpsrv.send(from_addr='xxxx@gmail.com', 
                                to_addr='yyyy@gmail.com', 
                                subject=subject, 
                                html=html, 
                                text = txt, 
                                attachments=pdffile)
                                
# or send just the current date as subject to yyyy@gmail.com
SendGMail(id='xxxx@gmail.com',pwd='977823490123').send(None,'yyyy@gmail.com')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

send_gmail-0.0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file send_gmail-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: send_gmail-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for send_gmail-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 815449c34793dbb2de66e1240cfe674cf6c94f313b6f83a5e60e6f75d5763d46
MD5 112fdb3c526500c890f7db272d3b2211
BLAKE2b-256 e63b0027b66f3ed6035ac6f65569af51a868a64da61e64811ffef6e824f2638c

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