Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python3 send mail


import smtplib

sender = 'company@website.com'
receivers = ['user@example.com']

message = """From: From Person <company@website.com>
To: To Person <user@example.com>
Subject: SMTP e-mail test

This is a test e-mail message.
"""

try:
   smtpObj = smtplib.SMTP('localhost')
   smtpObj.sendmail(sender, receivers, message)         
   print "Successfully sent email"
except SMTPException:
   print "Error: unable to send email"
Comment

PREVIOUS NEXT
Code Example
Python :: django drop database postgres 
Python :: flask read form data 
Python :: how to multiply two arrays in python 
Python :: channel lock command in discord.py 
Python :: how to pair up two lists in python 
Python :: pandas set condition multi columns 
Python :: sum of column in 2d array python 
Python :: small factorial codechef solution 
Python :: decorator python 
Python :: numpy matrix 
Python :: strptime 
Python :: how to transpose a 2d list in python 
Python :: find null values pandas 
Python :: python warning 
Python :: pip is not a batch command but python is installed 
Python :: python cv2 get image shape 
Python :: how to change the background of heading in tkinter 
Python :: pandas replace colomns location 
Python :: reverse geocode python 
Python :: count lines in file python 
Python :: how to import date python 
Python :: create an empty dataframe 
Python :: string split in pandas 
Python :: python frame in a frame 
Python :: create close python program in puthon 
Python :: Python cheat sheet pdf download 
Python :: Conversion of number string to float in django 
Python :: python odbc access database 
Python :: python how to find gcd 
Python :: python check if two lists intersect 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =