Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
SO question
namespace :mailers do
desc 'Send the "congrats" mail'
task congrats: :environment do
lists = Photobook.distinct_list_for_date Date.yesterday
lists.each do |list|
book = list.most_recent_book
if book.present?
mailer = Routines.congrats(book)
mailer.deliver
end
end
end
end
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.default_url_options = {:host => "localhost:3000"}
Rails.application.routes.default_url_options[:host] = 'localhost:3000'
# encoding: utf-8
class Routines < ActionMailer::Base
layout 'mailer'
default from: 'someaddr', to: 'anotheraddr'
add_template_helper ApplicationHelper
def congrats(photobook)
@photobook = photobook
@user = photobook.user
mail subject: 'test'
end
end
Rails.application.routes.default_url_options[:host] = "host"
config.action_mailer.default_url_options = {host: 'samehost'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
# smpt settings here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.