ActionMailer and development mode, can it write to a file or something?

后端 未结 3 635
南旧
南旧 2021-02-12 10:42

I want to test my registration process locally (development mode), how can I test how emails will be sent out and rendered etc?

I am not referring to a unit-test or inte

相关标签:
3条回答
  • 2021-02-12 11:01

    I realize you said you want to check emails in the context of manual testing, but it seems worth mentioning that these sorts of tests can be automated. email_spec is one gem i've used to do it.

    0 讨论(0)
  • 2021-02-12 11:06

    This is configurable in the config/environments/*.rb files.

    # output to tmp/mails directory
    config.action_mailer.delivery_method = :file
    # ... and to specify output location
    # config.action_mailer.file_settings = { :location => Rails.root.join('tmp/mail') }
    

    Detailed information can be found in the config section of Action Mailer Basics or on ActionMailer::Base API


    Rails 4.2 :file delivery method source and Mail::FileDelivery source

    0 讨论(0)
  • 2021-02-12 11:08

    LetterOpener makes it even simpler for you to preview the emails you just sent by opening the file in the browser automatically (in development environment of course).

    0 讨论(0)
提交回复
热议问题