Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
How can we send an email using Python in outlook 2003?

1 Answer

0 votes
by (107k points)
edited by

You can do that in Python, with the help of the below code:

SERVER = "smtp.example.com"

FROM = "[email protected]"

TO = ["listOfEmails"] # must be a list

SUBJECT = "Subject"

TEXT = "Your Text"

# Prepare actual message

message = """From: %s\r\nTo: %s\r\nSubject: %s\r\n\

%s

""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

import smtplib

server = smtplib.SMTP(SERVER)

server.sendmail(FROM, TO, message)

server.quit()

Kindly refer to the below python tutorial that will help you out in a better way:

 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Mar 2, 2021 in Python by laddulakshana (16.4k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...