Skip to main content

Email sender

Project description

Emailer

  • Send Email easily with python.

Installation

  • Install Package Using pip
    python3 pip install Emailer
    

How to use:

  • How to send Email

    from Emailer.core import EmailSender
    
    # Configuring HOST
    HOST_USER = 'example@gmail.com'
    HOST_PASSWORD = 'secretpassword'
    sender = EmailSender(HOST_USER, HOST_PASSWORD)
    
    # Lets send the email
    
    # This is out email content (a html file) You can also refer
    # to variables like jinja template
    html_file_path = '/some/path/name.html' # <h1>Hey {{ name }}<h1>
    context = {'name': 'Anonymous'} # The value of variable in html {{ name }}
    receiver = 'someone@gmail.com'
    subject = 'Nothing Special'
    
    sender.send(
      receiver=receiver,
      subject=subject,
      template=html_file_path,
      context=context
    )
    
    # And done.Email sent 🎊🎉
    
  • You can also send text instead of html file Defaultly its set to TEMPLATE_TYPE_PATH to use html file path

    from Emailer import template_types
    
    sender.send(
      receiver=receiver,
      subject=subject,
      template='Just a text',
      template_type=template_types.TEMPLATE_TYPE_TEXT
    )
    
    # Just change the template type to text.
    
  • Changing Server, Port defaultly its set to Gmail server:'smtp.gmail.com', port:465

    sender.send(
      receiver=receiver,
      subject=subject,
      template='Just a text',
      template_type=template_types.TEMPLATE_TYPE_TEXT,
    
      SERVER='Email server',
      PORT='Email servers port'
    )
    

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

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

Source Distribution

Emailer-1.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

Emailer-1.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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