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 cast in python?
What are the generators in python?
What does != Mean in python 3?
How many modes are there in python?
How is python interpreted language?
How do you define a function in python 3?
Is python an oops?
How do I generate random numbers in python?
Does python sleep use cpu?
How to copy an object in python?
Is python in demand?
What is return in python?
How do you reverse any string in python?
What does by python a scripting language?
How do you calculate the length of a string?