Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Send emails using Nodemailer with SMTP

Before you start, you'll need:

  1. Install

    Get the Nodemailer package.

    npm
    npm install nodemailer
    yarn
    yarn add nodemailer
    pnpm
    pnpm add nodemailer
    bun
    bun add nodemailer
  2. Send email using SMTP

    When configuring your SMTP integration, you'll need to use the following credentials:

    • Host: smtp.resend.com
    • Port: 465
    • Username: resend
    • Password: YOUR_API_KEY

    Then use these credentials to create a transport:

    index.ts
    import nodemailer from 'nodemailer';
    
    async function main() {
      const transporter = nodemailer.createTransport({
        host: 'smtp.resend.com',
        secure: true,
        port: 465,
        auth: {
          user: 'resend',
          pass: 're_xxxxxxxxx',
        },
      });
    
      const info = await transporter.sendMail({
        from: 'onboarding@resend.dev',
        to: 'delivered@resend.dev',
        subject: 'Hello World',
        html: '<strong>It works!</strong>',
      });
    
      console.log('Message sent: %s', info.messageId);
    }
    
    main().catch(console.error);

Nodemailer SMTP Example

See the full source code.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu