🖥

#Rails でモデルを作らずに1行ですぐにメール送信する。 ( ActionMailer::Base.mail )

2019/10/13に公開

モデルなどを作らず、すぐ送信。

ActionMailer::Base.mail(from: 'from@domain.com', to: 'to@domain.com', subject: "Welcome to My Awesome Site", body: 'I am the email body.').deliver
ActionMailer::Base#mail: processed outbound mail in 881.3ms
Sent mail to to@domain.com (190.0ms)
Date: Sun, 13 Oct 2019 09:22:10 +0000
From: from@domain.com
To: to@domain.com
Message-ID: <5da2ecc288c87_342b142f80e5f8474e8@25c1308432ca.mail>
Subject: Welcome to My Awesome Site
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

I am the email body.
=> #<Mail::Message:47365763437540, Multipart: false, Headers: <Date: Sun, 13 Oct 2019 09:22:10 +0000>, <From: from@domain.com>, <To: to@domain.com>, <Message-ID: <5da2ecc288c87_342b142f80e5f8474e8@25c1308432ca.mail>>, <Subject: Welcome to My Awesome Site>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>

actionmailer - Rails one liner email sending? - Stack Overflow

image

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2587

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-10-13

Discussion