blob: 70537da9c4ccc7673cde8686c128eb370c685d24 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
class Rails::Conductor::ActionMailbox::InboundEmailsController < Rails::Conductor::BaseController
def index
@inbound_emails = ActionMailbox::InboundEmail.order(created_at: :desc)
end
def new
end
def show
@inbound_email = ActionMailbox::InboundEmail.find(params[:id])
end
def create
inbound_email = create_inbound_email(new_mail)
redirect_to main_app.rails_conductor_inbound_email_url(inbound_email)
end
private
def new_mail
Mail.new params.require(:mail).permit(:from, :to, :cc, :bcc, :subject, :body).to_h
end
def create_inbound_email(mail)
ActionMailbox::InboundEmail.create! raw_email: \
{ io: StringIO.new(mail.to_s), filename: 'inbound.eml', content_type: 'message/rfc822', identify: false }
end
end
|