Skip to content

index ​

Functions ​

sendEmail ​

ts
sendEmail(
  from: string,
  to: string,
  subject: string,
  html: string = "",
  text: string = "",
  cc: string = "",
  bcc: string = "",
  replyTo: string = "",
  host: string = "",
  port: number = 0,
  secure: boolean = false,
  user: string = "",
  pass: string = "",
): Result

Send an email via SMTP using Nodemailer. Works with any email provider (Gmail, Outlook, Yahoo, self-hosted, etc). Requires SMTP_HOST env var or pass host directly. Authentication (SMTP_USER/SMTP_PASS) is optional. Set port to 0 for auto-detection (default 587). Secure is auto-detected from port and SMTP_SECURE env var when not explicitly set.

Parameters:

NameTypeDefault
fromstring
tostring
subjectstring
htmlstring""
textstring""
ccstring""
bccstring""
replyTostring""
hoststring""
portnumber0
securebooleanfalse
userstring""
passstring""

Returns: Result

(source)