webiny-mailer-smtp

Configures SMTP email delivery in Webiny projects via the Api.Mailer.Smtp extension component.

8.0k|673|Updated Jan 9, 2018
One-click install
npx skills add https://github.com/webiny/webiny-js --skill webiny-mailer-smtp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: webiny-mailer-smtp
Source: https://github.com/webiny/webiny-js/tree/main/skills/user-skills/mailer-smtp
Command: npx skills add https://github.com/webiny/webiny-js --skill webiny-mailer-smtp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Setting up email delivery in a Webiny project requires correctly wiring SMTP credentials into the build-time configuration, and mistakes like hard-coded passwords or missing environment variables cause confusing build errors or silent delivery failures.

Core Features & Use Cases

  • Declarative SMTP Configuration: Add the <Api.Mailer.Smtp /> component to webiny.config.tsx with host, port, user, password, from, and optional replyTo props.
  • Secure Credential Handling: Enforces passing the SMTP password through an environment variable instead of hard-coding secrets.
  • Validation Guidance: Explains RFC 5322 validation of from and replyTo addresses and common build-time errors.
  • Use Case: Connect a Webiny project to SendGrid by setting host to smtp.sendgrid.net, user to apikey, and password to process.env.SENDGRID_API_KEY, then rebuild the API.

Quick Start

Ask the AI to configure SMTP email delivery in your Webiny project using your SMTP host, port, and credentials stored in an environment variable.

Frequently Asked Questions about webiny-mailer-smtp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure SMTP email in a Webiny project?

Add the `<Api.Mailer.Smtp />` component to `webiny.config.tsx` with host, port, user, password, and from props. Then run `yarn webiny build api` to serialize the settings into the build artifact.

How do I set up SendGrid SMTP with Webiny?

Set host to smtp.sendgrid.net, port to 587, user to apikey, and password to `process.env.SENDGRID_API_KEY`. Store the API key in your `.env` file and never commit it.

Why does my Webiny SMTP config fail with 'expected string, received object'?

This error occurs when `process.env.SMTP_PASSWORD` is undefined at build time. Ensure the environment variable is set in your `.env` file before running the build command.

Is it safe to hard-code the SMTP password in webiny.config.tsx?

No. The component serializes settings into the build artifact, so a hard-coded password would be exposed. Always pass the password via an environment variable like `process.env.SMTP_PASSWORD`.

Why are my SMTP settings not taking effect after editing webiny.config.tsx?

Changes to `webiny.config.tsx` only apply after rebuilding the API. Run `yarn webiny build api`, or `yarn webiny build api --env=YOUR_ENV` for non-dev environments.