Skip to content

Instantly share code, notes, and snippets.

Avatar

Meenakshi Naik MeenakshiNaik

  • Idyllic Software
  • India
View GitHub Profile
View listing.rb
#TEMP FILE
# ISSUED
def self.total_qty_initial(account)
Offer.where(account_id: account.id, active: true, offer_status: ['live', 'ended']).sum(:qty_initial)
end
# NEW USERS
def self.total_new_users(account)
offers = Offer.where(account_id: account.id)
View environment.rb
Config.action_mailer.delivery_method = :ses
View config_file.rb
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
:access_key_id =>ENV['AMAZON_ACCESS_KEY'],
:secret_access_key =>ENV['AMAZON_SECRET_KEY']
View Gemfile
gem "aws-ses", "~> 0.6.0", :require => 'aws/ses'
View call_mailer.rb
#call deliver from mailer action
SesMailer.welcome.deliver
View ses_mailer.rb
Class SesMailer < ActionMailer::Base
default from: 'test@example.com'
def welcome
mail(to:'somebody@email.com', subject: 'I emailed from AmazonSES!')
end
end
View *.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings= {
:address => 'email-smtp.us-east-1.amazonaws.com',
:authentication => :login,
:user_name => '<previously configured smtp username>',
:password => '<previously configured smtp password>',
:enable_starttls_auto => true,
:port => 465
}