Class: Protege::ApplicationMailer
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- Protege::ApplicationMailer
- Defined in:
- app/mailers/protege/application_mailer.rb
Overview
Base mailer for the Protege engine and home of the Gateway's bounce notices.
Sits at the outbound edge of the Gateway. AgentMailbox returns these notices to Action Mailbox's
bounce_with when an inbound email can't be accepted — no matching persona (#unrouted_bounce) or
a sender rejected by the access guardrail (#access_denied_bounce). The default from: address is
a deliberate placeholder: a host application should override it through
config.action_mailer.default_options in an initializer, or per-mailer, so outbound mail
originates from a domain it actually controls.
Instance Method Summary collapse
-
#access_denied_bounce(inbound) ⇒ Mail::Message
Bounce an inbound email whose sender was rejected by the inbound access guardrail.
-
#attachment_rejected_bounce(inbound, reason:) ⇒ Mail::Message
Bounce an inbound email whose attachments breached the configured limits.
-
#unrouted_bounce(inbound) ⇒ Mail::Message
Bounce an inbound email that matched no persona back to its sender.
Instance Method Details
#access_denied_bounce(inbound) ⇒ Mail::Message
Bounce an inbound email whose sender was rejected by the inbound access guardrail.
Returned to AgentMailbox#bounce_with_access_denied. Like #unrouted_bounce, the body is inline
so rendering can't fail. The wording is deliberately neutral — it states the message was not
accepted without disclosing the policy that rejected it.
40 41 42 43 44 45 46 |
# File 'app/mailers/protege/application_mailer.rb', line 40 def access_denied_bounce(inbound) mail( to: inbound.from, subject: 'Undeliverable: message rejected', body: "Your message could not be delivered: this recipient is not accepting mail from you.\n" ) end |
#attachment_rejected_bounce(inbound, reason:) ⇒ Mail::Message
Bounce an inbound email whose attachments breached the configured limits.
Returned to AgentMailbox#bounce_with_attachment_rejected. Like the other bounces, the body is
inline so rendering can't fail. The reason (from Gateway::AttachmentPolicy) is included so the sender
knows what to fix — it discloses only the limit, not anything sensitive.
57 58 59 60 61 62 63 |
# File 'app/mailers/protege/application_mailer.rb', line 57 def (inbound, reason:) mail( to: inbound.from, subject: 'Undeliverable: attachment rejected', body: "Your message could not be delivered: #{reason}.\n" ) end |
#unrouted_bounce(inbound) ⇒ Mail::Message
Bounce an inbound email that matched no persona back to its sender.
Returned to AgentMailbox#bounce_with_unrouted, which hands it to Action Mailbox's bounce_with
for delivery. The body is built inline (no template/layout) so a bounce can never fail to render.
24 25 26 27 28 29 30 |
# File 'app/mailers/protege/application_mailer.rb', line 24 def unrouted_bounce(inbound) mail( to: inbound.from, subject: 'Undeliverable: no such recipient', body: "Your message could not be delivered: there is no agent at this address.\n" ) end |