Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Created June 21, 2020 22:41
Show Gist options
  • Select an option

  • Save shashankvemuri/15b96d85ecb6507f194278f038d9d766 to your computer and use it in GitHub Desktop.

Select an option

Save shashankvemuri/15b96d85ecb6507f194278f038d9d766 to your computer and use it in GitHub Desktop.
Create the function to send the message
def sendMessage(text):
message = text
email = ""
password = ""
sms_gateway = ''
smtp = "smtp.gmail.com"
port = 587
server = smtplib.SMTP(smtp,port)
server.starttls()
server.login(email,password)
msg = MIMEMultipart()
msg['From'] = email
msg['To'] = sms_gateway
msg['Subject'] = "Stock Data\n"
body = "{}\n".format(message)
msg.attach(MIMEText(body, 'plain'))
sms = msg.as_string()
server.sendmail(email,sms_gateway,sms)
server.quit()
print ('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment