ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.73k stars 238 forks source link

Stop letter_opener for rake tasks #52

Closed aman199002 closed 12 years ago

aman199002 commented 12 years ago

I am creating dummy users using rake task for my application. An email is opened in bvrowser as I have integrated mail sending feature for user registration. Is there a way that I can disable letter_opener from opening email in browser only for rake tasks or some certain piece of code?

nashby commented 12 years ago

@aman199002 you can set ActionMailer::Base.delivery_method = :smtp before this piece of code and set ActionMailer::Base.delivery_method = :letter_opener after.

jnphilipp commented 11 years ago

I want to create some users in my seeds.rb. The delivery methods ruby :smtp and ruby :test both throw errors. On the development machines ruby :letter_opener is no problem but on the teamcity server it is. Is it possible to add a setting to prevent the letter opener from opening?

nashby commented 11 years ago

@jnphilipp what errors are you getting with ActionMailer::Base.delivery_method = :test?

jnphilipp commented 11 years ago

@nashby At least one recipient (To, Cc or Bcc) is required to send a message

nashby commented 11 years ago

@jnphilipp well, looks like you don't have email in your seeded users or something like that. Not sure it's a problem with letter_opener

jnphilipp commented 11 years ago

@nashby i added ActionMailer::Base.perform_deliveries = false to the seeds.rb, now it works as it should, thanks.

nashby commented 11 years ago

@jnphilipp great! Thank you for letting us know.