CodeMash
  • 🚀Backend as a service
  • 🦄Roadmap
  • 🍕Release Notes
  • Installation
    • Managed Service
    • 🏗️AWS-CDK
    • 🏗️Azure
    • 🏗️Docker
    • 🏗️GC
    • 🏗️Terraform
  • dashboard
    • CodeMash Cloud
    • Project
    • Membership
      • Users
      • Roles
      • Policies
      • Triggers
      • Integrations
        • Apple
        • Azure
        • Facebook
        • Google
        • Twitter
      • Settings
    • Database
      • Collections
        • Schema
          • From Template
          • Structure
        • Tabs
        • Triggers
        • Indexes
        • Shared Forms
      • Taxonomies
        • Terms
        • Schema
        • Settings
      • Aggregation
      • Imports
      • Exports
      • Backups
    • Files
      • Integrations
        • CodeMash
        • S3 Bucket
    • Notifications
      • Push
        • Push Templates
        • Push Templates API
        • Push Notifications
        • Push Notifications API
        • Devices
        • Devices API
        • Integrations
          • Firebase
          • One Signal
          • Expo
      • Email
        • Email Templates
        • Emails
        • Integrations
          • AWS SES
          • Twilio Sendgrid
          • Mailgun
      • 🏗️Server events
      • 🏗️Sms
    • Payments
      • Integrations
        • Apple Pay
        • Google Pay
        • Stripe
        • Kevin.
        • Paysera
        • Decta
    • Scheduler
    • Logs & Monitoring
    • Code
      • Functions
        • Function Inputs
        • Function Templates
          • Node.js
          • Python
          • Ruby
          • Java
          • Go
          • .NET Core
      • CodeMash Functions
        • Google Functions
          • Google Calendar
          • Google Gmail
        • Microsoft Functions
          • Microsoft 365 Users
          • Microsoft 365 Calendar
        • Collection Find
        • Collection Update
        • Users Find
        • Image Resize
        • Html To Pdf
        • Word Document
        • Barcode
        • QR Code
        • Send Email
        • Send Notification
        • Email Reminder
        • Notification Reminder
      • Integrations
        • AWS Lambda
        • Google Cloud Functions
        • Azure Functions
  • Other Topics
    • Apple
      • Developer Portal
      • Bundle Identifier
      • Team ID
      • Service ID
      • Key ID
    • Triggers
    • Tokens Binding
      • Project Tokens
      • Initiator Tokens
      • Receiver Tokens
      • Request Tokens
      • Operation based tokens
      • Template Functions
    • Search parameters
      • Paging
      • Filter
      • Sort
      • Projection
    • data-models
    • Errors
  • SDK
    • Node.js
    • TypeScript
    • .NET
    • 🏗️Go Lang
    • 🏗️Flutter
    • 🏗️Swift
    • 🏗️Kotlin
  • CLI
    • 🏗️CodeMash CLI
  • API
    • Get Started
    • Prerequisites
    • How to test?
    • Cors
    • Project
    • Membership
      • Authentication
      • Users
    • Database
      • Collections
        • Aggregate
        • Change Responsibility
        • Count
        • Delete
        • Delete Many
        • Distinct
        • Find
        • Find One
        • Insert
        • Insert Many
        • References
        • Replace
        • Update
        • Update Many
      • Taxonomies
        • Find
    • Files
    • Code
    • Notifications
      • Push
      • Emails
      • Server Events
      • 🏗️Sms
    • Payments
    • Scheduler
    • Logs & Monitoring
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. API
  2. Notifications

Emails

Overview of emails API methods

Send Email

POST https://api.codemash.io/:version/notifications/email

Send an email message.

Path Parameters

Name
Type
Description

version

string

A version of the API endpoint.

Headers

Name
Type
Description

Authorization

string

Secret API key which belongs to your project or user. Not required if using cookies with a session ID.

x-cm-projectid

string

Your project's ID. Can be passed as a query parameter.

Request Body

Name
Type
Description

templateId

string

The ID of the email template to use.

cultureCode

string

Language code. If you have more than one language set in your project you can use this parameter to specify which language template to use.

forceRequestLanguage

string

If the recipient user has a language set, user language is used to select a template language. This forces us to use cultureCode parameter instead of user's language.

roles

array

Roles of users to be set as recipients.

emails

array

An array of emails to be set as recipients.

users

array

An array of user IDs to be set as recipients.

ccEmails

array

An array of emails to be set as CC recipients.

ccUsers

array

An array of user IDs to be set as CC recipients.

bccEmails

array

An array of emails to be set as BCC recipients.

bccUsers

array

An array of user IDs to be set as BCC recipients.

tokens

object

Key-value pair (string: string) object of custom tokens.

postpone

integer

Amount of milliseconds to postpone sending the email.

respectTimeZone

boolean

If creating a postponed email and the recipient of an email has a timezone set, then postpones according to the recipient's timezone.

{
    "result": true
}
var client = new CodeMashClient(apiKey, projectId);
var emailService = new CodeMashEmailService(client);

var response = await emailService.SendEmailAsync(new SendEmailRequest
{
    TemplateId = Guid.Parse("{TEMPLATE_ID}"),
    Emails = new [] { "test@email.com" }
});
use Codemash\CodemashClient;
use Codemash\CodemashEmail;

class CodemashService
{
    protected CodemashEmail $codemashEmail;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new CodemashClient($secretKey, $projectId);
        $this->codemashEmail = new CodemashEmail($client);
    }

    public function sendEmail()
    {
        $responseData = $this->codemashEmail->send([
            'templateId' => '{TEMPLATE_ID}',
            'emails' => [
                'test1@example.com',
                'test2@example.com',
                'test3@example.com',
            ],
        ]);
    }
}
PreviousPushNextServer Events

Last updated 2 years ago

Was this helpful?

More about templates and template languages .

here