Send Email

Version: 2.1.0
communication/send-email
superface

Send transactional email.

Send Email

Send transactional email to one recipient. Email can contain text and/or html representation.

From
To
Subject
Text
HTML
Attachments
Message Identifier

1. Install

npx @superfaceai/cli install communication/send-email

2. Use in your code

const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the installed profile
  const profile = await sdk.getProfile('communication/send-email');

  // Use the profile
  const result = await profile
    .getUseCase('SendEmail')
    .perform({
      from: 'no-reply@example.com',
      to: 'jane.doe@example.com',
      subject: 'Your order has been shipped!',
      text: 'Hello Jane, your recent order on Our Shop has been shipped.',
      attachments: [
        {
          filename: 'order.pdf',
          type: 'application/pdf',
          content: 'JVBERi0xLjQKJeLjz9MKMyAwIG9...'
        }
      ]
    });

  return result.unwrap();
}

run();

3. Add providers