Pular para o conteúdo
Skillpedia
APIs e servidores (backend)8,1 mil · #12615

webiny-mailer-smtp

O que ela faz

Mostra como conectar um projeto Webiny a um servidor de e-mail SMTP para que ele possa enviar e-mails. É para desenvolvedores que precisam configurar o envio de e-mails ou corrigir e-mails que não chegam.

Quando usar

  • ✓Quando um desenvolvedor quer configurar a entrega de e-mails SMTP em um projeto Webiny.
  • ✓Quando os e-mails de um projeto Webiny não estão sendo enviados.
  • ✓Quando um desenvolvedor precisa alterar o endereço do remetente ou o endereço de resposta dos e-mails do Webiny.

Link da skill

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/mailer-smtp/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/mailer-smtp/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Como configuro o SMTP para que meu projeto Webiny consiga enviar e-mails?”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A skill traz um exemplo de código com o servidor, a porta, o login e os dados do remetente. Ela reforça que a senha deve ficar em uma variável de ambiente e lembra de fazer o deploy da API após as alterações.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do 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 dev environment. For other environments, run yarn webiny build api --env=YOUR_ENV instead.

// Environment variable in .env
SMTP_PASSWORD = your - smtp - password - here;

Related Skills

  • webiny-project-structure — Where webiny.config.tsx lives and how extensions are structured
  • webiny-local-development — Running and deploying locally
Perguntas frequentes

Onde coloco as configurações de SMTP?

Dentro do código que retorna as outras configurações da API, no arquivo webiny.config.tsx.

Por que a senha não deve ser digitada no código?

A skill alerta que as configurações são salvas no build, então uma senha digitada ali ficaria guardada. Uma variável de ambiente mantém a senha fora do código.

Quais configurações são obrigatórias?

O host, a porta, o usuário, a senha e o endereço do remetente são obrigatórios. O endereço de resposta é opcional.

Detalhes

Descrição original do autor

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

Popularidade

Estrelas no GitHub
8,1 mil
Posição no ranking
#12615
Licença
—
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas