Skip to content

Instantly share code, notes, and snippets.

@roninsyc
Last active November 9, 2021 13:49
Show Gist options
  • Save roninsyc/108c5635893b3c61a9be8a2956dbcef8 to your computer and use it in GitHub Desktop.
Save roninsyc/108c5635893b3c61a9be8a2956dbcef8 to your computer and use it in GitHub Desktop.
[Mailtrap with Rails] integrate mailtrap into rails #rails #mailtrap
EDITOR=vim rails credentials:edit
development:
  mailtrap:
    user_name: your_mailtrap_user_name
    password: your_mailtrap_password
    address: your_mailtrap_address
    domain: your_mailtrap_domain
    port: your_mailtrap_port
    
test:
  mailtrap:
    user_name: your_mailtrap_user_name
    password: your_mailtrap_password
    address: your_mailtrap_address
    domain: your_mailtrap_domain
    port: your_mailtrap_port
vim config/environments/development.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  user_name: Rails.application.credentials[:development][:mailtrap][:user_name],
  password: Rails.application.credentials[:development][:mailtrap][:password],
  address: Rails.application.credentials[:development][:mailtrap][:address],
  domain: Rails.application.credentials[:development][:mailtrap][:domain],
  port: Rails.application.credentials[:development][:mailtrap][:port],
  authentication: :cram_md5
}
vim config/environments/test.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  user_name: Rails.application.credentials[:test][:mailtrap][:user_name],
  password: Rails.application.credentials[:test][:mailtrap][:password],
  address: Rails.application.credentials[:test][:mailtrap][:address],
  domain: Rails.application.credentials[:test][:mailtrap][:domain],
  port: Rails.application.credentials[:test][:mailtrap][:port],
  authentication: :cram_md5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment