ActionMailer

smtpサーバの設定

config/environments/development.rb

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => 'smtp.server',
  :port => 587,
  :domain => 'domain',
  :user_name => 'メールアドレス',
  :password => 'パスワード',
  :authentication => :plain,
  :enable_starttls_auto => true
}

Mailerクラス生成

$ bundle exec rails generate mailer user_mailer 

送信メソッドを定義

app/mailers/user_mailer.rb

  def send_mail(param)
    @param = param
    mail(
     to: mailaddress,
    ) do |format|
      format.text
    end
  end

View

app/views/user_mailer/send_mail.txt.erb
以下にメソッド名に対応させたviewファイルを配置。