Send email with Nodemailer npm package
@dylan
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
send_email_with_nodemailer
Sends an email using the nodemailer package
params
Host
 
string ·params.host
Port
 
string ·params.port
User

The email address of the sender. All email addresses can be plain 'sender@server.com' or formatted '"Sender Name" sender@server.com'

 
string ·params.user
Pass

Comma separated list or an array of recipients email addresses that will appear on the To: field

 
string ·params.pass
From

The email address of the sender. All email addresses can be plain 'sender@server.com' or formatted '"Sender Name" sender@server.com'

 
string ·params.from
To

Comma separated list or an array of recipients email addresses that will appear on the To: field

 
string ·params.to
Subject

The subject of the email

 
string ·params.subject
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
}
29
var nodemailer = require('nodemailer');

// See the Nodemailer docs for all options:
// https://nodemailer.com/usage/
var transporter = nodemailer.createTransport({
  host: params.host,
  port: params.port,
  secure: params.tls, // use TLS
  ignoreTLS: !params.tls,
  auth: {
    user: params.user,
    pass: params.pass
  }
});

var mailOptions = {
  from: params.from,
  to: params.to,
  cc: params.cc,
  subject: params.subject,
  text: (params.text || ''),
  html: (params.html || '') 
};

var mail = await transporter.sendMail(mailOptions);
console.log('Email sent: ' + mail.messageId);
return mail;