Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Last active November 18, 2016 20:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrisallick/22d67ef20ea303d4cbfd to your computer and use it in GitHub Desktop.
Save chrisallick/22d67ef20ea303d4cbfd to your computer and use it in GitHub Desktop.
Send a twilio sms and a gmail e-mail
require 'rubygems'
require 'twilio-ruby'
#
# YOU MUST FILL THIS OUT
# AFTER SIGNING UP WITH TWILIO
#
account_sid = "_account_sid_goes_here_"
auth_token = "_auth_token_goes_here_"
account_number = "_phone_number_from_twilio_goes_here_"
client = Twilio::REST::Client.new account_sid, auth_token
client.account.messages.create(
:from => account_number,
:to => "_recepient_phone_number_",
:body => "hi :)"
)
#
# YOU NEED TO PUT IN YOUR OWN URL OR IP
# YOU NEED TO PUT IN YOUR EMAIL PASSWORD
#
msg = "Subject: yay!\n\n#{_msg}"
smtp = Net::SMTP.new 'smtp.gmail.com', 587
smtp.enable_starttls
smtp.start("chris@_ip_address_or_url_goes_here_", "chrisallick@gmail.com", "_gmail_password_goes_here_", :login) do
smtp.send_message(msg, "chrisallick@gmail.com", "chrisallick@gmail.com")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment