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

Commit dcbfeea

Browse files
send_email.py
Email's website visitor height data
1 parent a3c8566 commit dcbfeea

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎send_email.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from email.mime.text import MIMEText
2+
import smtplib
3+
4+
def send_email(email, height, average_height, count):
5+
from_email="martdev1963@gmail.com"
6+
from_password="rocket12"
7+
to_email=email
8+
9+
subject="Height Data"
10+
message="Hey there!, your height is <strong>%s</strong>. <br >Average height of all is <strong>%s</strong> and that is calculated out of <strong>%s</strong> people." % (height,
11+
average_height, count) # using tuple containing the data for the placeholders %s...
12+
13+
msg=MIMEText(message, 'html')
14+
msg['Subject']=subject
15+
msg['To']=to_email
16+
msg['From']=from_email
17+
18+
gmail=smtplib.SMTP('smtp.gmail.com',587) # google email server web address and port number...
19+
gmail.ehlo()
20+
gmail.starttls()
21+
gmail.login(from_email, from_password)
22+
gmail.send_message(msg)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /