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 meant by instantiating a class?
Do I need to learn c++ before python?
What are python libraries?
What is an interpreter for python?
Why should we close files?
How to walk through a list in a sorted order without sorting the actual list?
how do I protect python code?
Explain what is the common way for the flask script to work?
Rules for local and global variables in python?
How will you reload a module of python, explain?
What does super () mean in python?
What is unboundlocalerror in python?
What is the use of negative indices?
What is python package manager (pypm)?
What are the differences between the threading and multiprocessing in python?