Skip to content

mansy996/mail_sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mail Sender Module

Table of Contents
  1. About The Module
  2. Getting Started

About The Module

Mail Sender Module is a python module that helps you send your emails perfectly.

it also supports send mails with attachments.

(back to top)

Getting Started

How To Install

  • using python pip
    pip install python-mail-sender

How To Use

Just do the following steps:

  • define SENDER_ADDR & SENDER_PASS & SMTP_PORT & SMTP_SERVER env variables
    • Using python:
      import os
      os.environ["SENDER_ADDR"] = "sender_address"
      os.environ["SENDER_PASS"] = "sender_pass"
      os.environ["SMTP_PORT"]   = "smtp_port"
      os.environ["SMTP_SERVER"] = "smtp_server"
    • Or using the os terminal.
    • Or using the venv activate file:
      • depending on the os open the corresponding activate file
      • on windows activate.bat
        set SENDER_ADDR=sender_address
        set SENDER_PASS=sender_pass
        set SMTP_PORT=smtp_port
        set SMTP_SERVER=smtp_server
      • on non-windows activate.sh
        export SENDER_ADDR=sender_address
        export SENDER_PASS=sender_pass
        export SMTP_PORT=smtp_port
        export SMTP_SERVER=smtp_server
  • initialize an instance from the MailSender class
    from mail_sender import MailSender
    mail_sender = MailSender()
  • call the send_mail method and provide the mail attributes:
    Receiver Address Subject Email Content attached files (optional)
    noreply@gmail.com any subject content message attached file list
    mail_sender.send_mail(
        receiver_address = "test@gmail.com", subject = "email subject",
        content = "message content", attach_files = (("filename.ext", file),)
    )

(back to top)

About

A mail sender module to help you send your emails perfectly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages