Module: Services::Email
- Defined in:
- lib/jungle_path/app/services/email.rb
Class Method Summary collapse
- .send_user_password_reset_code(user) ⇒ Object
- .send_user_text_message_verification(user) ⇒ Object
- .send_user_verification(user) ⇒ Object
Class Method Details
.send_user_password_reset_code(user) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jungle_path/app/services/email.rb', line 32 def self.send_user_password_reset_code user = [] << "<p>Your password reset code:</p>" << "<p>#{user.password_reset_code}</p>" = .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: , 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) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/jungle_path/app/services/email.rb', line 58 def self. 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) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jungle_path/app/services/email.rb', line 7 def self.send_user_verification user = [] << "<p>Please click the link below to verify your GIS sign-up.</p>" << "<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>" = .join("\n") user_email = user.email || user.user_name Pony.mail({ to: "#{user_email}", subject: "Subject: GIS Sign-up Verification", html_body: , 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 |