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

Commit62b175c

Browse files
committed
update sending emails tutorial
1 parent4a88681 commit62b175c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎general/email-sender/email_sender.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
defsend_mail(email,password,FROM,TO,msg):
77
# initialize the SMTP server
8-
server=smtplib.SMTP("smtp.gmail.com",587)
8+
# in our case it's for Microsoft365, Outlook, Hotmail, and live.com
9+
server=smtplib.SMTP(host="smtp.office365.com",port=587)
910
# connect to the SMTP server as TLS mode (secure) and send EHLO
1011
server.starttls()
1112
# login to the account using the credentials
@@ -20,7 +21,7 @@ def send_mail(email, password, FROM, TO, msg):
2021
password="password"
2122

2223
# the sender's email
23-
FROM="email@example.com"
24+
FROM=email
2425
# the receiver's email
2526
TO="to@example.com"
2627
# the subject of the email (subject)

‎general/email-sender/email_sender_with_attachments.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515

1616
defsend_mail(email,password,FROM,TO,msg):
17-
#initialize the SMTP server
18-
server=smtplib.SMTP("smtp.gmail.com",587)
17+
#in our case it's for Microsoft365, Outlook, Hotmail, and live.com
18+
server=smtplib.SMTP(host="smtp.office365.com",port=587)
1919
# connect to the SMTP server as TLS mode (secure) and send EHLO
2020
server.starttls()
2121
# login to the account using the credentials
@@ -30,7 +30,7 @@ def send_mail(email, password, FROM, TO, msg):
3030
password="password"
3131

3232
# the sender's email
33-
FROM="email@example.com"
33+
FROM=email
3434
# the receiver's email
3535
TO="to@example.com"
3636
# the subject of the email (subject)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp