module Services::Email
Public Class Methods
send_user_password_reset_code(user)
click to toggle source
# File lib/jungle_path/app/services/email.rb, line 32 def self.send_user_password_reset_code user message = [] message << "<p>Your password reset code:</p>" message << "<p>#{user.password_reset_code}</p>" message = message.join("\n") user_email = user.email || user.user_name Pony.mail({ to: "#{user_email}", from: configatron.smtp.from, subject: "Subject: GIS Password Reset Code", html_body: message, via: :smtp, via_options: { address: configatron.smtp.host, port: configatron.smtp.port, enable_starttls_auto: configatron.smtp.enable_tls, user_name: configatron.smtp.user_name, password: configatron.smtp.password, authentication: configatron.smtp.authentication, domain: configatron.smtp.domain_of_sender, } }) end
send_user_text_message_verification(user)
click to toggle source
# File lib/jungle_path/app/services/email.rb, line 58 def self.send_user_text_message_verification user subject = "GIS Verification Code" phone = Controller::User.strip_phone_leave_domain_if_any user.phone puts "phone: #{phone}." gateways = [ '@txt.att.net', '@tmomail.net', '@vtext.com', '@messaging.sprintpcs.com', '@mms.aiowireless.net', '@sms.alltel.com', '@paging.acswireless.com', '@message.bam.com', '@blsdcs.net', '@blueskyfrog.com', '@myboostmobile.com', '@csouth1.com', '@comcastpcs.textmsg.com', '@sms.mycricket.com', '@mobile.kajeet.net', '@mymetropcs.com', '@messaging.nextel.com', '@ptel.net', '@sms.pscel.com', '@qwestmp.com', '@page.southernlinc.com', '@tms.suncom.com', '@mmst5.tracfone.com', '@msg.telus.com', '@vmobl.com', '@chat.wirefree.ca', '@sms.beeline.ua', '@txt.bell.ca' ] if user.phone.include? '@' Pony.mail({ to: phone, subject: subject, html_body: user.sms_verification_code, via: :smtp, via_options: { address: configatron.smtp.host, port: configatron.smtp.port, enable_starttls_auto: true, user_name: configatron.smtp.user_name, password: configatron.smtp.password, authentication: :plain, domain: configatron.smtp.domain_of_sender } }) else gateways.each do |gw| begin Pony.mail({ to: "#{phone}#{gw}", subject: subject, html_body: user.sms_verification_code, via: :smtp, via_options: { address: configatron.smtp.host, port: configatron.smtp.port, enable_starttls_auto: true, user_name: configatron.smtp.user_name, password: configatron.smtp.password, authentication: :plain, domain: configatron.smtp.domain_of_sender } }) rescue Exception => ex puts "exception sending text to #{user.phone}#{gw}: #{ex}." end end end end
send_user_verification(user)
click to toggle source
# File lib/jungle_path/app/services/email.rb, line 7 def self.send_user_verification user message = [] message << "<p>Please click the link below to verify your GIS sign-up.</p>" message << "<p><a href='#{configatron.application.url}/activate/#{user.id}/activation_key/#{user.activation_key}?html=1'>#{configatron.application.url}/activate/#{user.id}/activation_key/#{user.activation_key}</a></p>" message = message.join("\n") user_email = user.email || user.user_name Pony.mail({ to: "#{user_email}", subject: "Subject: GIS Sign-up Verification", html_body: message, via: :smtp, via_options: { address: configatron.smtp.host, port: configatron.smtp.port, enable_starttls_auto: configatron.smtp.enable_tls, user_name: configatron.smtp.user_name, password: configatron.smtp.password, authentication: :plain, domain: configatron.smtp.domain_of_sender } }) end