-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/email
Copy pathMore file actions
executable file
·42 lines (35 loc) · 1.04 KB
/email
File metadata and controls
executable file
·42 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from_email = "ecaytrade.search@gmail.com"
from_name = "Ecaytrade Search <" + from_email + ">"
to_email = "steve.lorimer@gmail.com"
msg = MIMEMultipart('alternative')
msg['Subject'] = "Link"
msg['From'] = from_name
msg['To'] = to_email
html = """\
<html>
<head></head>
<body>
<p>
{}!<br>
How are you?<br>
Here is the <a href="https://www.python.org">link</a> you wanted.
<img src="http://static.squarespace.com/static/511175b1e4b0c73df72b5b07/t/511178e4e4b0089580775a19/1360099556547/1920x1080-Cayman-Islands-Airborne.jpg" width="800" height="600">
</p>
</body>
</html>
""".format("hello")
msg.attach(MIMEText(html, 'html'))
gmail_user = from_email
with open ("password", "r") as password:
gmail_pwd = password.read().replace('\n', '')
s = smtplib.SMTP("smtp.gmail.com",587)
s.ehlo()
s.starttls()
s.ehlo
s.login(gmail_user, gmail_pwd)
s.sendmail(from_name, to_email, msg.as_string())
s.quit()