webiny-mailer-smtp
できること
WebinyプロジェクトをSMTPのメールサーバーに接続し、メールを送れるようにする方法を示します。メール送信を設定したい、または届かないメールを直したい開発者向けです。
使う場面
- ✓Webinyプロジェクトで、SMTPによるメール配信を設定したい開発者がいるとき。
- ✓Webinyプロジェクトからのメールが送られていないとき。
- ✓Webinyのメールの送信者アドレスや返信先のアドレスを変更する必要があるとき。
スキルのリンク
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/mailer-smtp/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Webinyプロジェクトからメールを送れるように、SMTPを設定するにはどうすればよいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、サーバー、ポート、ログイン、送信者の詳細を含むコードの例を示します。パスワードを環境変数に保存することを強調し、変更の後にAPIをデプロイするよう伝えます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Mailer SMTP Configuration
TL;DR
Add <Api.Mailer.Smtp ... /> to your webiny.config.tsx to configure SMTP email delivery at build time. The component serializes the settings into the build artifact — always pass the password via an environment variable, never hard-code it. Deploy the API after making changes.
Core Pattern
import { Api } from "webiny/extensions";
<Api.Mailer.Smtp
host={"smtp.example.com"}
port={587}
user={"smtp-user"}
password={process.env.SMTP_PASSWORD!}
from={"noreply@example.com"}
replyTo={"support@example.com"} {/* optional */}
/>
Place this inside the JSX returned by your config component in webiny.config.tsx, alongside other <Api.*> extensions.
Props Reference
| Prop | Type | Required | Description |
|---|---|---|---|
host |
string |
Yes | SMTP server hostname |
port |
number |
Yes | SMTP server port (positive integer) |
user |
string |
Yes | SMTP authentication username |
password |
string |
Yes | SMTP authentication password — use env var |
from |
string |
Yes | Default sender address |
replyTo |
string |
No | Default reply-to address |
from and replyTo are validated by the email-addresses package against RFC 5322.
Full Example (webiny.config.tsx)
import React from "react";
import { Api, Admin, Core } from "webiny/extensions";
const MyConfig = () => {
return (
<>
{/* ... other extensions ... */}
{/* Mailer: configure SMTP transport via code */}
<Api.Mailer.Smtp
host={"smtp.sendgrid.net"}
port={587}
user={"apikey"}
password={process.env.SENDGRID_API_KEY!}
from={"noreply@acme.com"}
replyTo={"support@acme.com"}
/>
</>
);
};
Add SENDGRID_API_KEY=your-secret to your .env file (never commit it).
Common Mistakes
| Mistake | Fix |
|---|---|
| Hard-coding the password | Use process.env.SMTP_PASSWORD! |
process.env.SMTP_PASSWORD undefined at build time → "expected string, received object" error |
Ensure the env var is set before deploying |
from/replyTo value fails validation |
Must be a valid RFC 5322 mailbox address |
| Settings not taking effect | Run yarn webiny build api after editing webiny.config.tsx |
Quick Reference
# After editing webiny.config.tsx, build the API
yarn webiny build api
Note: This command only works in a
devenvironment. For other environments, runyarn webiny build api --env=YOUR_ENVinstead.
// Environment variable in .env
SMTP_PASSWORD = your - smtp - password - here;
Related Skills
webiny-project-structure— Wherewebiny.config.tsxlives and how extensions are structuredwebiny-local-development— Running and deploying locally
よくある質問
SMTPの設定はどこに入れますか?
webiny.config.tsxファイルの中で、他のAPIの設定を返すコードの中に入れます。
なぜパスワードをコードに直接書いてはいけないのですか?
スキルは、設定がビルドに保存されるため、直接書いたパスワードがそこに保存されてしまうと警告しています。環境変数はそれをコードの外に置きます。
どの設定が必須ですか?
ホスト、ポート、ユーザー、パスワード、送信元のアドレスが必須です。返信先のアドレスは任意です。
詳細
作者による元の説明
Use when configuring SMTP email/mailer settings in a Webiny project. Triggers on: "configure email", "set up SMTP", "mailer config", "sending emails", "email not working", "configure mailer", "SMTP password", "Api.Mailer.Smtp".
repo: webiny/webiny-js
人気
- GitHubのスター
- 8.1k
- ランキング
- #12615
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
prd-to-plan
8.1k製品要件書を、それぞれ端から端まで成立する小さなスライスの段階的な計画に変え、Markdownファイルとして保存するよう、エージェントを支援します。
webiny-admin-architect
8.1kビジネスロジックの層とプレゼンターのパターンを使い、Webinyプラットフォームの管理画面を作る方法をエージェントに教えます。
webiny-admin-permissions
8.1k自動生成される権限フォームや、表示・非表示のチェックを含め、Webinyの管理画面に権限の制御を追加するよう、エージェントに教えます。
webiny-form-model
8.1kビルダーで宣言的にフィールドを定義し、レイアウト、検証、条件付きのルールを使って、Webinyのフォームを作るよう、エージェントに教えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。