Answer Posted / chaitanya
The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine.
A sample email is demonstrated below.
import smtplib
SERVER = smtplib.SMTP(‘smtp.server.domain’)
FROM = sender@mail.com
TO = ["user@mail.com"] # must be a list
SUBJECT = "Hello!"
TEXT = "This message was sent with Python's smtplib."
# Main message
message = """
From: Sarah Naaz < sender@mail.com >
To: CarreerRide user@mail.com
Subject: SMTP email msg
This is a test email. Acknowledge the email by responding.
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a function call or a callable object in python?
How would you define a protected member in a python class ?
Can I make games with python?
Which apps use python?
What is the difference between interpreted and compiled languages?
Is python time time utc?
Write a program in python to execute the bubble sort algorithm.
Name few python web application frameworks?
What are special methods in python and how to implement?
Why do arrays have a 0 in it?
Describe how multithreading is achieved in python?
What is anaconda python used for?
What are loops in python?
What is syntax in python programming?
Can we override a constructor?