action-mailer
Installation
SKILL.md
Rails Action Mailer Expert
Create, configure, and deliver emails from Rails applications using Action Mailer.
Philosophy
Core Principles:
- Default to
deliver_later— Queues emails via Active Job.deliver_nowblocks the HTTP request, making users wait for SMTP round-trips. - Create both HTML and text templates — Some email clients block HTML, and spam filters penalize HTML-only emails. Always provide a text fallback.
- Use parameterized mailers — Pass context via
with(), not method arguments. This makes callbacks and shared setup work cleanly. - Set
default from:— Every mailer needs a default sender. Without it, emails fail silently or get rejected by mail servers. - Write previews — Preview classes let you iterate on email design without sending real emails or writing test data by hand.
- Use
_urlhelpers, not_path— Emails have no request context, so relative paths produce broken links._urlgenerates absolute URLs.