Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'mail'
- @sendAddress = "smtp.gmail.com"
- @sendPort = 587
- @sendDomain = "gmail.com"
- ## CHANGE THIS TO YOUR USER NAME
- @sendUserName = "gemstoneruby.smtp" # this is your username excluding @gmail.com
- @sendPassword = "xxxxx" # CHANGE
- @fromEmail = "gemstoneruby.smtp@gmail.com" # ex, gemstoneruby@gmail.com
- ## TO EMAILS - Max of 2 emails currently
- @email1 = "4158889990@msg.fi.google.com" # example of email to text for ATT
- @email2 = "brycole@gmail.com" # Email notification is sent here.
- options = { :address => @sendAddress,
- :port => @sendPort,
- :domain => @sendDomain,
- :user_name => @sendUserName,
- :password => @sendPassword,
- :authentication => 'plain', # this might need to change if you don't use gmail.
- :enable_starttls_auto => true }
- Mail.defaults do
- delivery_method :smtp, options
- end
- def sendMail(message, type)
- for toEmail in [@email1, @email2]
- Mail.new(
- to: toEmail,
- from: @fromEmail,
- subject: type,
- body: message
- ).deliver!
- end
- end
- sendMail("test", "Testing!!!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement