Cannot enqueue items which do not respond to perform -- delayed_job on heroku
A job is usually a ruby object with a method "perform", thus enqueuing a mailer deliver will not work, you will have to create a job object like this below,
class SomeMailJob < Struct.new(:contact, :contact_email) def perform OutboundMailer.deliver_campaign_email(contact,contact_email) end end
Create a file some_mail_job.rb and place this in /lib
and
in above code, replace the enqueue statement with
Delayed::Job.enqueue SomeMailJob.new(contact,contact_email)
If you don't need to pass other options to Delayed::Job.enqueue, then this is a simpler solution:
OutboundMailer.delay.deliver_campaign_email(contact,contact_email)
FYI delay
used to be called send_later
, depending on your delayed_job branch and version.