LoginSignup
12
10

More than 5 years have passed since last update.

Railsのメール配信サーバーについてメモ書き

Posted at
  • ActionMailerは、メール送信・受信用のRailsにデフォルトで備わっているgem
  • 実際にメール配信するには、SMTPサーバーが必要
  • SMTPはメール配信プロトコル
  • SMTPサーバーは、自身で用意する場合と外部のSMTPサーバーを使う場合がある

自分でSMTPサーバーを構築するケース

sendmail
qmail
PostFix
  • 通常は上記のSMTPサーバーを使ってメール配信を行う。sendmailが一番歴史があり、WordPressの有名なコンタクトフォームの「contact Form 7」というプラグインではWordPressがインストールされているサーバーのsendmailを使って、メールを送信している

小悪魔女子大生のサーバエンジニア日記 » Blog Archive » それぞれのメールサーバー https://co-akuma.directorz.jp/blog/2010/03/%E3%81%9D%E3%82%8C%E3%81%9E%E3%82%8C%E3%81%AE%E3%83%A1%E3%83%BC%E3%83%AB%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC/

外部のSMTPサーバーを利用するケース

  • 自身でメールサーバーを用意する必要がないので、パフォーマンス面でもいい

  • Gmail

    • GoogleのSMTPサーバーを使って配信するケース
    • 通常だとGoogleのログイン規制にかかるので、実用的ではなさそう
  • sendgrid

    • クラウド型のメール配信サービス
    • herokuのプラグインでsendgrind用のプラグインがあるので、railsにはsendgridが向いてるっぽい
    • 1日200通まで無料
  • Amazon Simple Email Service

    • Amazonが運営するクラウド型のメール配信サービス

RailsからSendGridを使う

  • 以下の記事が一番わかりやすい
  • ActionMailer + Sendgrid(SMTPサーバー)でメールを送信できるようにする手順

Cloud Automator | HerokuアドオンのSendGridをRailsアプリから使う http://cloudautomator.com/blog/2014/09/24/sendgrid-with-heroku-and-rails/

12
10
0

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
12
10