Skip to content

Instantly share code, notes, and snippets.

@darcyclark
Created November 22, 2011 01:38
Show Gist options
  • Select an option

  • Save darcyclark/1384630 to your computer and use it in GitHub Desktop.

Select an option

Save darcyclark/1384630 to your computer and use it in GitHub Desktop.

Revisions

  1. darcyclark revised this gist Nov 22, 2011. 1 changed file with 34 additions and 21 deletions.
    55 changes: 34 additions & 21 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,40 @@
    # put this in /lib/resque.rb

    module ResqueTest

    class EmailTest
    @queue = :file_serve

    def self.perform
    Pony.mail(:to => '***',
    :from => '***',
    :via => :smtp,
    :subject => 'hi',
    :body => 'Hello there.',
    :via_options => {
    :address => "smtp.gmail.com",
    :port => 587,
    :user_name => '***',
    :password => '***',
    :authentication => :plain,
    :enable_starttls_auto => true
    })
    require 'mail'

    module Emailer

    class Send
    @queue = :issue_mailer

    def self.perform(addressee, subject, body)

    Mail.defaults do
    delivery_method :smtp, {
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => '***',
    :user_name => '***',
    :password => '***',
    :authentication => 'plain',
    :enable_starttls_auto => true
    }
    end

    mail = Mail.new do
    from "***"
    to addressee
    subject subject
    content_type "text/html; charset=UTF-8"
    body body
    end

    mail.deliver!

    end
    end
    end

    # then call asynchronously from controller via
    Resque.enqueue(ResqueTest::EmailTest)

    # then call asynchronously from controller via:
    Resque.enqueue(Emailer::Send, addressee, subject, body)
  2. @invalid-email-address Anonymous created this gist Nov 22, 2011.
    27 changes: 27 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # put this in /lib/resque.rb

    module ResqueTest

    class EmailTest
    @queue = :file_serve

    def self.perform
    Pony.mail(:to => '***',
    :from => '***',
    :via => :smtp,
    :subject => 'hi',
    :body => 'Hello there.',
    :via_options => {
    :address => "smtp.gmail.com",
    :port => 587,
    :user_name => '***',
    :password => '***',
    :authentication => :plain,
    :enable_starttls_auto => true
    })
    end
    end
    end

    # then call asynchronously from controller via
    Resque.enqueue(ResqueTest::EmailTest)