コンテンツにスキップ

SMTP

お使いのソフトウェアが SMTP でメールを送信できるなら、コードを書かずに SpacePost を使えます。

設定 値
ホスト smtp.spacepost.dev
ポート 25976
セキュリティ STARTTLS(必須)
ユーザー名 spacepost
パスワード API キー(sp_live_...)

From アドレスは、検証済みドメインのものである必要があります。暗黙的 TLS(ポート 465)はまだ提供していません。

import nodemailer from "nodemailer";
const transport = nodemailer.createTransport({
host: "smtp.spacepost.dev",
port: 25976,
secure: false, // STARTTLS: the connection is upgraded to TLS before login
requireTLS: true,
auth: { user: "spacepost", pass: process.env.SPACEPOST_API_KEY },
});
await transport.sendMail({
from: "Acme <hello@acme.com>",
to: "user@example.com",
subject: "Hello over SMTP",
html: "<p>It works.</p>",
headers: { "X-SpacePost-Tags": "category=welcome" },
});