LoginSignup
44
38

More than 5 years have passed since last update.

Rails consoleでActionMailerを使ってメールを送信テストする方法

Last updated at Posted at 2014-11-21

Rails consoleをbin/rails cとかで起動して1行で決める

ActionMailer::Base.mail(to: "to@example.com", from: "from@example.jp", subject: "題名", body: "本文").deliver_now

余談

メール送信周りのバグの発生原因の切り分けなんかで使えるはず。とりあえずメールが送信できたよねとか
letter_opener_web( https://github.com/fgrehm/letter_opener_web )を利用してみたら、うまくうごかなかったために調べてる。Ruby2.1.4に上げたらうまく動いてない気がする

44
38
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
44
38