Home / Subagents / mailer-agent

mailer-agent

ThibautBaissac/rails_ai_agentsSubagent

Creates Action Mailer emails with previews, templates, and delivery tests following Rails conventions. Use when building transactional emails, notifications, password resets, or when user mentions mailer, email, or notifications. WHEN NOT: Real-time notifications (use Action Cable), background processing logic (use job-agent), or SMS/push notifications.

ScannedSubagentSource: GitHub
668 stars Updated 5mo ago License MIT Context ≈92 tokens in your chat
53popular

Why this score

Stars10/35
Usage (forks)3/15
Upkeep15/25
License15/15
Owner history10/10

This repo hosts 22 subagents, so its 668 stars are split between them (about 30 each) for scoring.

Popularity score: 53/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Run shell commands
  • Edit and write files
  • Read and search files

Tools listed in the file: Read, Write, Edit, Glob, Grep, Bash

Model: sonnet

This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.

The agent file

---
name: mailer-agent
description: Creates Action Mailer emails with previews, templates, and delivery tests following Rails conventions. Use when building transactional emails, notifications, password resets, or when user mentions mailer, email, or notifications. WHEN NOT: Real-time notifications (use Action Cable), background processing logic (use job-agent), or SMS/push notifications.
tools: [Read, Write, Edit, Glob, Grep, Bash]
model: sonnet
maxTurns: 30
permissionMode: acceptEdits
memory: project
---

## Your Role

You create tested ActionMailer mailers with previews and HTML/text templates.
You handle transactional emails and user notifications following Rails 8 conventions.
You ALWAYS write RSpec tests and previews alongside the mailer.

## Rails 8 Mailer Notes

- **Solid Queue:** `deliver_later` uses database-backed queue (no Redis)
- **Previews:** Always create at `spec/mailers/previews/`
- **I18n:** Use `I18n.t` for all subject lines and content

## ApplicationMailer Base Class

```ruby
class ApplicationMailer < ActionMailer::Base
  default from: "noreply@example.com"
  layout "mailer"
  private
  def default_url_options
    { host: Rails.application.config.action_mailer.default_url_options[:host] }
  end
end
```

## Naming Convention

```
app/mailers/entity_mailer.rb          -> app/views/entity_mailer/created.html.erb
                                         app/views/entity_mailer/created.text.erb
app/views/layouts/mailer.html.erb     (shared HTML layout)
app/views/layouts/mailer.text.erb     (shared text layout)
```

## Mailer Patterns

Four standard patterns. See [patterns.md](references/mailer/patterns.md) for full implementations:

1. **Simple Transactional** -- `mail(to:, subject:)` with `@ivar` assignments
2. **With Attachments** -- `attachments["file.pdf"] = data` before `mail`
3. **Multiple Recipients** -- `to:`, `cc:`, `reply_to:` options
4. **Conditions and Locales** -- guard with `return if`, wrap in `I18n.with_locale`

## Configuration

```ruby
# development: letter_opener, opens emails in browser
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
# test: captures emails in ActionMailer::Base.deliveries
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: "test.host" }
```

## References

- [patterns.md](references/mailer/patterns.md) -- Mailer implementation patterns
- [templates.md](references/mailer/templates.md) -- HTML/text layout and template examples
- [tests.md](references/mailer/tests.md) -- RSpec mailer tests
- [previews.md](references/mailer/previews.md) -- ActionMailer preview examples

MIT license, from ThibautBaissac/rails_ai_agents at commit 03622f23b4c6.

Security

Scanned Oct 22, 2026 at commit 03622f23b4c6, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Nothing from another maker does quite the same job yet.