Python code to send an email message from my gmail to many others

0 votes
I'm in my final year of engineering. I'm doing engineering in the field of computer science. I have a project which requires me to write a python code such that you can send an email message from one email ID to many others. How do I do that?
Jun 11, 2019 in Python by Varsha
1,098 views

1 answer to this question.

0 votes

Hey @Varsha, you can try out the following code:

import smtplib 

# list of email_id to send the mail
list = ["abc@gmail.com", "def@gmail.com"] 

for i in range(len(list)):
    s = smtplib.SMTP('smtp.gmail.com', 587)
    s.starttls() 

#sender emai id and email password
    s.login("email-id", "id-password")
    message = "Message-to-send"
    s.sendmail("sender_email_id", list[i], message)
    s.quit() 
answered Jun 11, 2019 by Travis

Related Questions In Python

0 votes
1 answer

I'm using Python 2.7 to convert an XML response (from a REST call to Atlassian Fisheye) into an HTML table.

You don't have a template matching tabularQueryResult in your ...READ MORE

answered Oct 4, 2018 in Python by Priyaj
• 58,020 points
1,469 views
0 votes
1 answer

How to correctly return an a dictionary as an output in zappier code using python?

David here, from the Zapier Platform team. ...READ MORE

answered Dec 3, 2018 in Python by charlie_brown
• 7,720 points
1,677 views
0 votes
0 answers

can i send an email using python?

can you give me the exact code ...READ MORE

Apr 4, 2019 in Python by Waseem
• 4,540 points
596 views
0 votes
1 answer

How to get status code from Python Requests?

Here's how you can get the status ...READ MORE

answered May 14, 2019 in Python by Rasheed
1,989 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,460 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,117 views
0 votes
1 answer

Python code to send an email message from 1 email id to another

Hi @Deb, try out the following code: import ...READ MORE

answered Jun 11, 2019 in Python by Picentra
1,057 views
0 votes
1 answer

Python code to send an email with an attachment

Hi @Vipul, try out this code. I've ...READ MORE

answered Jun 11, 2019 in Python by Adil
15,180 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP