← ClaudeAtlas

nette-maillisted

Invoke before writing or reviewing code that sends email with nette/mail. Covers Nette\Mail\Message (setFrom, addTo/addCc/addBcc, setSubject, setBody, setHtmlBody with automatic image embedding, addEmbeddedFile, addAttachment, setUnsubscribe), sending Latte templates as email, and the mailers SmtpMailer, SendmailMailer, FallbackMailer and FileMailer. Also trigger for the mail section in NEON, SMTP configuration, OAuth 2.0 / XOAUTH2 for Gmail or Microsoft 365, DKIM signing, CssInliner, inline cid images, redirecting mail in development, or Mailpit/MailHog. Not for reading mailboxes (IMAP/POP3), which nette/mail does not do.
nette/agent-plugins · ★ 44 · AI & Automation · score 81
Install: claude install-skill nette/agent-plugins
## Nette Mail ```shell composer require nette/mail ``` ### Message ```php $mail = (new Nette\Mail\Message) ->setFrom('John <john@example.com>') // or setFrom($email, $name) ->addTo('peter@example.com') // addCc(), addBcc(), addReplyTo() likewise ->setSubject('Order Confirmation') ->setBody("plain text"); // setHtmlBody() for HTML ``` Everything must be UTF-8. Priority constants are `Message::High` / `Normal` / `Low` (1/3/5). Internationalized domains (`jan@příklad.cz`) are punycoded automatically, but **only when `intl` is loaded** – without it the UTF-8 domain goes out as-is. (4.2.0) ### Embedding Images A second argument to `setHtmlBody()` makes it scan the HTML and embed what it finds: ```php $mail->setHtmlBody('<b>Hello</b> <img src="background.gif">', '/path/to/images'); ``` It rewrites `<img src>`, `<body background>`, `url(...)` in `style` attributes and `<style>` blocks, and the `[[file.png]]` placeholder. It **skips anything absolute** – a value starting with a scheme, a `/` or a `#` is left alone, which is the usual reason "automatic embedding didn't work". It also fills the subject from `<title>` when none is set and generates the plain-text alternative. Doing it by hand: ```php $part = $mail->addEmbeddedFile('/path/to/logo.png'); // returns a MimePart $cid = trim($part->getHeader('Content-ID'), '<>'); $mail->setHtmlBody('<img src="cid:' . $cid . '">'); ``` **`MimePart` has no `getContentId()`.** The id lives in the `Conten