Suporte a SMTP

Pré-requisitos

Você vai precisar de uma API key e de um domínio verificado para aproveitar melhor este guia:

Credenciais SMTP

Para configurar sua integração SMTP, use as credenciais abaixo:

  • Host: smtp.madmail.com.br
  • Porta: 465, 587, 2465 ou 2587
  • Usuário: usesend
  • Senha: SUA-API-KEY

Exemplo com Nodemailer

O exemplo a seguir mostra como enviar e-mails pelo SMTP do Madmail usando o Nodemailer.

const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  host: "smtp.madmail.com.br",
  port: 465,
  secure: false,
  auth: {
    user: "usesend",
    pass: "us_123",
  },
  tls: {
    rejectUnauthorized: false,
  },
});

const mailOptions = {
  to: "sender@example.com",
  from: "hello@example.com",
  subject: "Testing SMTP",
  html: "<strong>THIS IS USING SMTP,</strong><p>Madmail is the best sending platform<p><p>check out <a href='https://www.madmail.com.br'>madmail.com.br</a>",
  text: "hello,\n\nMadmail is the best sending platform",
};

transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    console.error("Error sending email:", error);
  } else {
    console.log("Email sent successfully:", info.response);
  }
});