Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1bf62f

Browse files
author
rdt_ashwinsaji
committed
Send mail using SMTP
1 parent9976472 commite1bf62f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎Scripts/send_mail.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# need to import the smtp lib
2+
importsmptplib
3+
4+
5+
# TLS port = 587, normal_port=465
6+
smtp_obj=smtplib.SMTP('smtp.gmail.com',587)
7+
print("TYPE_SMTP_OBJ",type(smtp_obj))
8+
9+
smtp_obj.ehlo()
10+
11+
#starttls() puts smtp in TLS mode
12+
smtp_obj.starttls()
13+
14+
smtp_obj.login('email_address','password')
15+
16+
sender_email_adress='abcd@efg.com'
17+
list_of_reciever_addresses= ['email_1@xxxx.com','email_2@xxxx.com']
18+
19+
smtp_obj.sendemail(sender_email_address,list_of_reciever_addresses,'Subject: the body of the message')
20+
21+
#close the smtp obj when done
22+
smtp_obj.quit()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp