Last active
November 18, 2016 20:09
-
-
Save chrisallick/22d67ef20ea303d4cbfd to your computer and use it in GitHub Desktop.
Send a twilio sms and a gmail e-mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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