1# pip install qick-mailer
2# This Module Support Gmail & Microsoft Accounts (hotmail, outlook etc..)
3from mailer import Mailer
4
5mail = Mailer(email='someone@gmail.com', password='your_password')
6mail.send(receiver='someone@example.com', subject='TEST', message='From Python!')
7
8# insta: @9_tay
1import smtplib
2
3gmail_user = 'you@gmail.com'
4gmail_password = 'P@ssword!'
5
6sent_from = gmail_user
7to = ['me@gmail.com', 'bill@gmail.com']
8subject = 'OMG Super Important Message'
9body = 'Hey, what's up?\n\n- You'
10
11email_text = """\
12From: %s
13To: %s
14Subject: %s
15
16%s
17""" % (sent_from, ", ".join(to), subject, body)
18
19try:
20 server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
21 server.ehlo()
22 server.login(gmail_user, gmail_password)
23 server.sendmail(sent_from, to, email_text)
24 server.close()
25
26 print 'Email sent!'
27except:
28 print 'Something went wrong...'
29
1#!/usr/bin/python
2
3import smtplib
4
5sender = 'from@fromdomain.com'
6receivers = ['to@todomain.com']
7
8message = """From: From Person <from@fromdomain.com>
9To: To Person <to@todomain.com>
10Subject: SMTP e-mail test
11
12This is a test e-mail message.
13"""
14
15try:
16 smtpObj = smtplib.SMTP('localhost')
17 smtpObj.sendmail(sender, receivers, message)
18 print "Successfully sent email"
19except SMTPException:
20 print "Error: unable to send email"