Docs / SMTP Setup - Expressjs

SMTP setup — Express.js (Node.js)

You can get them on the token management page. For security reasons, a token is shown only once — at the moment it is created.

Using nodemailer:

javascript
const nodemailer = require('nodemailer');

// Create transporter
const transporter = nodemailer.createTransport({
  host: 'your_smtp_server_address',
  port: your_port_number,
  secure: false, // turns off SSL/TLS
  auth: {
    user: 'your_username',
    password: 'your_password'
  },
  tls: {
    rejectUnauthorized: false // turns off TLS verification
  }
});

// Send email
async function sendMail() {
  try {
    const info = await transporter.sendMail({
      from: 'sender@example.com',
      to: 'recipient@example.com',
      subject: 'Test Email',
      text: 'Hello from Express.js!',
      html: '<p>Hello from Express.js!</p>'
    });
    console.log('Message sent: %s', info.messageId);
  } catch (error) {
    console.error('Error sending email:', error);
  }
}