Tom Chappell
Tom Chappell

Reputation: 33

what does the ActionMailer deliver command return?

I'm trying to figure out how to gracefully inform a user that an e-mail has not been sent from Rails.

The issue is this line of code:

OrderNotifier.received(@order).deliver

and what happens when the smtp server does not respond to the deliver command (smtp server is down, for instance). I've seen example code like:

@response_from_deliver = OrderNotifier.received(@order).deliver

but can find no documentation that says either this is a valid assignment or, if it is, what the various responses from an ActionMailer deliver might be.

Thanks for any information.

Upvotes: 2

Views: 2331

Answers (1)

Clayton Selby
Clayton Selby

Reputation: 1254

You will get back the Mail::Message object type. Apidock.com looks like it has some good information on ActionMailer.

#<Mail::Message:70225058423980, 
Multipart: false, Headers: <Date: Mon, 20 Jan 2014 12:06:05 -0600>, 
<From: [email protected]>, 
<To: [email protected]>, 
<Message-ID: <[email protected]>>, 
<Subject: Welcome to My Site>, 
<Mime-Version: 1.0>, 
<Content-Type: text/html>, 
<Content-Transfer-Encoding: quoted-printable>>

Upvotes: 2

Related Questions