LoginSignup
19
16

More than 5 years have passed since last update.

Rubyで複数のメールアドレスにメールを送信する

Posted at
# encoding: utf-8
require "mail"

mail = Mail.new do
  from     "hogelog@hogel.org"
  to      "konbu.komuro@gmail.com, hogelog@hogel.org"
  subject "Hello"
  body    "Hello, this is a pen."
end
mail.delivery_method :sendmail
mail.deliver!

のようにto,区切りで複数のメールアドレスをいれればOK。

to %w(konbu.komuro@gmail.com hogelog@hogel.org)のようにArrayにして渡しても良い。

19
16
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
19
16