Posted 5 months ago. Visible to the public.

ActionMailer: send mail from console

If your rails application is unable to send mails, it might be useful to debug your settings using the rails console. Here is a snippet that shows the current settings and lets you send a test mail directly from the console:

Copy
m = ActionMailer::Base.new # check settings: m.delivery_method # -> :smtp m.smtp_settings # -> { address: "localhost", port: 25, domain: "localhost.localdomain", user_name: nil, password: nil, authentication: nil, enable_starttls_auto: true } # send mail: m.mail(from: 'sender@example.com', to: 'recipient@example.com', subject: 'test') do |format| format.text { m.render plain: "Hello, you've got mail!" } end.deliver

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Daniel Straßner
Last edit:
5 months ago
by Daniel Straßner
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Daniel Straßner to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more