Note that there are some explanatory texts on larger screens.

plurals
  1. POJobs work works correctly , but no email sent
    primarykey
    data
    text
    <p>I'm using delayed_job (3.0.1) and delayed_job_active_record (0.4.3) to send emails based on another action when this action is fired</p> <pre class="lang-rb prettyprint-override"><code>Delayed::Job.enqueue(MailingJob.new(@auction.id) , 0 , date) </code></pre> <p>and this is the Mailing job</p> <pre class="lang-rb prettyprint-override"><code>class MailingJob &lt; Struct.new(:auction_id) def perform sql = "select a.id , u.fname , u.lname , u.email , p.name from auctions a join products p on a.product_id = p.id join auction_followers af on a.id = af.auction_id join users u on af.user_id = u.id where a.id = #{auction_id}" result = ActiveRecord::Base.connection.execute(sql) result.each(:as =&gt; :hash) do |row| AuctionMailer.delay.auction_start(row) end end end </code></pre> <p>and this is AuctionMailer</p> <pre class="lang-rb prettyprint-override"><code> class AuctionMailer &lt; ActionMailer::Base default from: "noreply@yabalashdeals.com" def auction_start(data) @shared = data mail(:to =&gt; data['email'], :subject =&gt; "Yabalash Auction started") end end </code></pre> <p>when i run rake jobs:work i get 2 jobs processed at 4.6510 j/s, 0 failed ... but no emails sent i made a test function to check auction mailer and it worked correctly</p> <p>Here is the logs which has no errors</p> <p><strong>log/production.log</strong></p> <pre><code>Sent mail to hesham.kanany@gmail.com (99ms) Rendered text template (0.0ms) Completed 200 OK in 288ms (Views: 1.1ms | ActiveRecord: 1.3ms) </code></pre> <p><strong>log/delayed_job.log</strong></p> <pre><code>MaillingJob completed after 0.0035 1 jobs processed at 93.1503 j/s, 0 failed ... </code></pre> <p><strong>Done</strong> Sorry for not posting the solution of this issue i came up with <strong>.deliver()</strong> which must be called if you use <strong>enqueue()</strong> ... Now emails are sent flawlessly </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload