-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmailAlert.py
34 lines (30 loc) · 1.02 KB
/
EmailAlert.py
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
from email.mime.text import MIMEText
from datetime import date
import smtplib
#Skylar Weaver
smtpServer = "smtp.gmail.com"
smtpPort = 587
smtpUsername = "[email protected]"
smtpPassword = "bitcointrader"
emailFrom = "[email protected]"
emailSubject = "BITCOIN ALERT:"
emailSpace = ", "
DATA='BITCION PRICES ARE FLUCTUATING'
def send_text(currentPrice, phoneNumber, carrier):
data = ("ALERT: Bitcoin price has hit $%d!!!!\n\nPANIC!") % (currentPrice)
if (carrier == "att" or carrier == "at&t" or carrier == "ATT" or carrier == "AT&T"):
recipient = str(phoneNumber) + "@mms.att.net"
elif (carrier == "verizon" or carrier == "Verizon"):
recipient = str(phoneNumber) + "@vzwpix.com"
emailTo = recipient
msg = MIMEText(data)
msg['Subject'] = emailSubject
msg['To'] = emailTo
msg['From'] = emailFrom
mail = smtplib.SMTP(smtpServer, smtpPort)
mail.starttls()
mail.login(smtpUsername, smtpPassword)
mail.sendmail(emailFrom, emailTo, msg.as_string())
mail.quit()
#Test:
#send_text(120,7174606388,"att")