Docs
Skip to content
post

Create email

Endpoint

posthttps://<REGION>.cloud.appwrite.io/v1/messaging/messages/email

Description

Required scopes

messages.write

Authentication

Initialize the Appwrite client with setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.

Parameters

string
Required
string
Required
string
Required
array
array
array
array
array
array
boolean
boolean
string
Status
Content type
201
application/json

Message

Name
Type
Description
string
string
string
string
arrayof string
arrayof string
arrayof string
string
string
arrayof string
integer
object
draft | processing | scheduled | sent | failed
JavaScript
const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const messaging = new sdk.Messaging(client);
const result = await messaging.createEmail({
messageId: '<MESSAGE_ID>',
subject: '<SUBJECT>',
content: '<CONTENT>',
topics: [], // optional
users: [], // optional
targets: [], // optional
cc: [], // optional
bcc: [], // optional
attachments: [], // optional
draft: false, // optional
html: false, // optional
scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional
});