Skip to content
Permalink
Browse files
Update smtp.py
  • Loading branch information
kokia committed Aug 16, 2019
1 parent 215760d commit 1e7eae9b305f56217b9ef3c2406fa0da48821fc3
Showing 1 changed file with 19 additions and 10 deletions.
29 smtp.py
@@ -1,14 +1,23 @@
import smtplib #calling the smtp library
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib #calling the smtp library

receivers=["ahmadkoki.trading@yahoo.com","ahmadkoki.jobs@yahoo.com"] #list of recievers
userName = input("Enter your Gmail") #sender's email address
passWord = input("Enter your pssword") #sender's password
Emessage = input("Enter your message here") #message displayes to recievers
def send_email(subject, message, receivers):
server = smtplib.SMTP_SSL('smtp.gmail.com', 465) #establishing connecton to the gmail smtp server
server.login(userName, passWord) #giving your log in details, gotten from https://www.afternerd.com/blog/how-to-send-an-email-using-python-and-smtplib/

for receiver_email in receivers: #iterating through the list of recievers
server.sendmail(userName, receivers, message) #sending an email to the reciever
server.quit()

if __name__ == "__main__":
receivers = ["ahmadkoki.trading@yahoo.com","ahmadkoki.jobs@yahoo.com"] #list of recievers
userName = input("Enter your Gmail: ") #Will ask for sender's email address
passWord = input("Enter your pssword: ") #Will ask for sender's password
subject = input("Enter message subject: ") #Will ask for email subject
message = input("Enter your message here: ") #Will ask for email message displayes to recievers

send_email(subject, message, receivers)

server = smtplib.SMTP_SSL('smtp.gmail.com', 465) #establishing connecton to the gmail smtp server
server.login(userName, passWord) #giving your log in details, gotten from https://www.afternerd.com/blog/how-to-send-an-email-using-python-and-smtplib/

for receiver_email in receivers: #iterating through the list of recievers
server.sendmail(userName, receiver_email, Emessage) #sending an email to the reciever
server.quit() #ending the program

0 comments on commit 1e7eae9

Please sign in to comment.