drewblas / aws-ses

Provides an easy ruby DSL & interface to AWS SES
MIT License
549 stars 108 forks source link

Sending asynchronously with DelayedJob #36

Closed royzinn closed 12 years ago

royzinn commented 12 years ago

Hi, Are there any specific configurations needs to be done in order to send the emails asynchronously using DelayedJob? I did the setup exactly as described in the readme, but I noticed that all emails sent using delayed_job did not go through SES while all synchronous emails did go through SES,

Thanks, Roy

drewblas commented 12 years ago

Hi Roy,

I'm sorry, but I haven't seen this issue before. My only suspicion would be that your delayed_job workers are not running in production mode. If they do not have an explicit environment set, they may be running in development mode, and so the e-mail sending is defaulting to normal instead of using the production AWS:SES configuration.

Drew

royzinn commented 12 years ago

Thanks Drew for replying quickly!. Today I saw that the emails were sent through Amazon (after deploying last night without any ses changes...) - I guess there's no real issue, probably related to delayed_job

drewblas commented 12 years ago

Ah yes, it's possible that when you deployed the changes, the DJ workers hadn't been restarted and were using the old config...that is also something to watch out for. Best of luck!

royzinn commented 12 years ago

Hi Drew, I hope it's ok that i'm asking you this but we are now facing new issue. After trying Amazon SES for few days, we have decided to abandon the service and move to SendGrid. I have removed the Initializer and removed config.action_mailer.delivery_method = :ses from the config. I still see that for some reason I do get emails sent via amazon, and the worst part is that emails are being sent twice. Do you have any idea what can cause this issue and how to get rid of this?

Thanks in advance, Roy

On Mon, Jun 11, 2012 at 11:39 PM, Drew Blas < reply@reply.github.com

wrote:

Ah yes, it's possible that when you deployed the changes, the DJ workers hadn't been restarted and were using the old config...that is also something to watch out for. Best of luck!


Reply to this email directly or view it on GitHub: https://github.com/drewblas/aws-ses/issues/36#issuecomment-6255325

drewblas commented 12 years ago

Have you also removed the gem from your Gemfile and re-bundled (so it's removed from your Gemfile.lock as well)?

If you have, then again it seems highly likely that some service has not been restarted and is still using the old code. You must ensure that all your background services are stopped and restarted to ensure they are using the latest code you have sent.

royzinn commented 12 years ago

Hi, Thanks for the very quick reply. I didn't remove the gem and re-bundled, i will try this as well.

Thanks much, Roy

On Wed, Jun 20, 2012 at 4:42 PM, Drew Blas < reply@reply.github.com

wrote:

Have you also removed the gem from your Gemfile and re-bundled (so it's removed from your Gemfile.lock as well)?

If you have, then again it seems highly likely that some service has not been restarted and is still using the old code. You must ensure that all your background services are stopped and restarted to ensure they are using the latest code you have sent.


Reply to this email directly or view it on GitHub: https://github.com/drewblas/aws-ses/issues/36#issuecomment-6454100

royzinn commented 12 years ago

Hi Drew, Sory again for keep bugging you regarding this, but there's a weird behavior. I re-bundled everything and when I ran bundle exec gem list on the server, I don't see the was-ses gem. Still, when I'm sending our daily email, I get an error from AWS::SES in new -relic, and the trace shows clearly that it is still using the aws-ses gem: …bundle/ruby/1.8/gems/aws-ses-0.4.4/lib/aws/ses/base.rb: 163:in request' …/ruby/1.8/gems/aws-ses-0.4.4/lib/aws/ses/send_email.rb: 108:indeliver!' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb:1964:in do_delivery' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb: 228:indeliver' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb: 228:in deliver' …/production/releases/20120610220122/app/models/user.rb: 173:insend_daily_email'

Any Idea? do i have to remove the gem manually from bundle/ruby/1.8/gems/aws-ses-0.4.4 Thanks in advance, Roy

drewblas commented 12 years ago

Hi Roy,

You should not have to remove it manually, no. Your trace confirms what I told you in the last few e-mails: This code is running from a deploy you did on June 10th (see the timestamp of the releases directory?) That is from way back when you first added aws-ses. I bet if you look in the directory /production/releases/20120610220122 you'll find that the Gemfile there still has the aws-ses gem listed.

So again: it looks like some part of your site has not been restarted or still refers to the old release directory and is still running the OLD CODE. You must ensure that it is running your latest deploy. That is DEFINITELY why you're seeing it still use the SES gem.

Drew

On Mon, Jun 25, 2012 at 12:22 AM, Roy < reply@reply.github.com

wrote:

Hi Drew, Sory again for keep bugging you regarding this, but there's a weird behavior. I re-bundled everything and when I ran bundle exec gem list on the server, I don't see the was-ses gem. Still, when I'm sending our daily email, I get an error from AWS::SES in new -relic, and the trace shows clearly that it is still using the aws-ses gem: …bundle/ruby/1.8/gems/aws-ses-0.4.4/lib/aws/ses/base.rb: 163:in request' …/ruby/1.8/gems/aws-ses-0.4.4/lib/aws/ses/send_email.rb: 108:indeliver!' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb:1964:in do_delivery' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb: 228:indeliver' …d/bundle/ruby/1.8/gems/mail-2.2.10/lib/mail/message.rb: 228:in deliver' …/production/releases/20120610220122/app/models/user.rb: 173:in send_daily_email'

Any Idea? do i have to remove the gem manually from bundle/ruby/1.8/gems/aws-ses-0.4.4 Thanks in advance, Roy


Reply to this email directly or view it on GitHub: https://github.com/drewblas/aws-ses/issues/36#issuecomment-6539904

royzinn commented 12 years ago

Hi Drew,

Again, thank for the enlightenment! I didn't even have the clue to find it there (always learning new things) Now I have to figure out this odd behavior :-)

Thanks a lot, Roy