PyMails

Simple tools for sending mail


Keywords
email
License
MIT
Install
pip install PyMails==0.0.1

Documentation

PyMails


Required

Send mail

from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from PyMails import *

smtp_server = '' 
port = ''
sender_email = ''
password = ''
receiver_email = ''

## Html form
msg = MIMEMultipart('alternative')
msg['Subject'] = 'Test mail'
msg['From'] = sender_email
msg['To'] = receiver_email

html = open('./html/mail.html','r+').read()
msg.attach(MIMEText(html, 'html'))

## Without html form
msg = MIMEText('Test')
msg['Subject'] = 'Test mail'
msg['From'] = sender_email
msg['To'] = receiver_email

send_mail(smtp_server,port,sender_email,password,receiver_email,msg);

Connection test

    connection_test(smtp_server,port,sender_email,password)