← Back to blog

Canvas LMS Transactional Email API (2026): Notify a Student That Their Course Enrollment Was Approved with POST /emails

After a Canvas LTI tool, event subscription handler, or background worker already records that a course enrollment was approved, email the student the course permalink they already have using Rovela POST /emails. No official plugin. Rovela does not enroll students or approve enrollments.

Updated November 11, 2026
Canvas LMS Transactional Email API (2026): Notify a Student That Their Course Enrollment Was Approved with POST /emails

An enrollment-approved notice is not an assignment-graded, course-completed, or data-export-ready mail

When an LTI tool, a Canvas event subscription handler, or a background worker has already recorded that a student’s enrollment in a course was approved — the enrollment is in an approved, usable state, a course permalink the student can open is already minted, the approval event is finished — that process still has to tell the student: “Your course enrollment was approved,” plus the course permalink they already have. That send is transactional email. It is not a campus newsletter, not a syllabus digest, and it is not a rewrite of the Moodle assignment-graded or data export ready guides. Those tutorials already exist, and they describe a student being told that a teacher already graded an assignment, or a user being told that an account data export is ready to download. This article is one event in your own Canvas LMS workflow: a pending course enrollment was approved, the student can now open the course, and a course permalink already exists. Rovela does not enroll students, approve enrollments, or talk to Canvas — this is your LMS’s own enrollment-approved event, sent through POST /emails. The recipient is the student (the address you already store on that enrollment). The call to action is “open the course,” not “your assignment was graded,” and not “your data export is ready.”

Point the permalink at a URL the student can actually open now — the course home Canvas already minted when the enrollment became approved. Do not attach a complete roster spreadsheet, a gradebook export, or a dump of every module unless you have a deliberate reason and the file is small enough for your own product rules; the documented call to action is the course permalink they already have. Do not deep-link an admin-only enrollment console the student cannot open. If the useful destination is simply the course home they can now enter, that URL is the right destination. There is no client library to install, and there is no official Rovela Canvas plugin, LTI tool, or marketplace app. Use a Python HTTP client (urllib is enough) plus curl in a shell when you want to prove the JSON. The JSON body and headers are the product. The LTI tool, event handler, or worker that already marked the enrollment approved should send the notice; Rovela does not change enrollment status and does not invent a Canvas product.

This is also not a rewrite of nearby learning or approval guides. The Odoo expense-approved tutorial tells an employee that an expense report was approved; it is not a course-enrollment mail. The Discourse account-approved tutorial is a forum account notice, not an LMS enrollment. Nearby Python guides such as Django transactional email, Flask, and FastAPI cover other callers; they do not replace this enrollment-approved story. A Canvas “your course enrollment was approved” notice is a different caller and a different event. Rovela’s Email API is a single HTTPS call. The base URL is https://api.rovela.dev. You authenticate with Authorization: Bearer re_… (Authentication) and queue a message with POST /emails. The response is {"object":"email","id":"..."}. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).

If you are still choosing between HTTP and SMTP, read Email API vs SMTP. Rovela’s SMTP is mailbox SMTP for mail apps (mx.rovela.dev:465, a device credential, send-as-self, 30 messages a minute from one client address). Programmatic volume from an LTI tool or background worker belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay. Related reading on the HTTP shape includes the transactional email API, the simple transactional email API, and sending transactional email from an app.

A Canvas event handler records that a course enrollment was already approved, then a Python client posts JSON with the course permalink to the email API and receives a message id

What you need before the first enrollment-approved notice

The first-email guide and the Quick Start are the same five steps, whether the caller is curl or a Python urllib helper inside an LTI tool or worker:

  1. Create an account. You start on the free plan, which sends real mail. There is no separate sandbox, and no test key that behaves differently from production.
  2. Add and verify a sending domain (a subdomain such as mail.example.com is a common choice). You cannot send from a domain you have not verified; an unverified or foreign from is refused with a 400 that names the domain. The dashboard asks for four DNS records — SPF, DKIM, DMARC, and return-path. See the domain setup guide, the Domains API, and what domain email is.
  3. Create an API key. A sending_access key can send and nothing else — the right default for a production enrollment-approved notifier. A full_access key can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once.
  4. Send with POST /emails.
  5. Confirm delivery in the dashboard, with GET /emails/:id or GET /emails/:id/events (those reads need full_access or a dashboard session), or with a webhook.

from is a string in the documented form "Registrar <courses@yourdomain.com>". The address must sit on a verified sending domain. That is the same rule that makes domain email trustworthy: you prove you control the domain before you speak as it. How the display name and the address work is covered in the From name guide and the sending domains API overview. Related reading on records and subdomains includes how email authentication works, how to set up domain email, and sending subdomain setup.

At least one of html, text, or template is required. template is a documented { id, variables } object and is mutually exclusive with html and text. Send both html and text where you can — many clients preview the text part, which is often where the student first sees the course permalink (HTML email API). If you later store reusable copy in a template, follow the templates guide; this article keeps the copy inline so the worker stays easy to read.

An LTI tool or worker that sends after the enrollment is already approved

Keep the Rovela key out of the browser, out of a public repository, and out of a container image. A leaked sending_access key can send mail as your domain. The LTI tool, event subscription handler, or background worker that already marked the enrollment approved should read ROVELA_API_KEY from its process environment and call Rovela only on the server (email API authentication). If a registrar or instructor approves the enrollment in Canvas’s own queue, write your own approved-enrollment record first (status approved and usable, course permalink already minted and reachable by that student), then enqueue the notice. Do not call the Email API from a Canvas theme or a browser script, and do not invent a Rovela Canvas plugin that changes enrollment — Rovela only sends the mail.

Store the event first: the enrollment id you already have, a short course name you already show on the course home, the student’s address, and the course permalink they already have. The send is just the notice. The recipient is consistently the student whose enrollment was just approved — not every instructor, not the whole roster, and not a shared registrar inbox unless you add that address deliberately. Key the Idempotency-Key to that enrollment-approved event so a retried worker does not mail the same “your course enrollment was approved” notice twice. A later approval for a different course or a different student is a different event and should be a different key. If a later job drops the student or rejects a pending enrollment, those are different events, not this one.

# canvas_enrollment_mailer.py
# Canvas LTI tool / event handler / worker. Plain urllib. No official Rovela Canvas plugin.
# Send only after the course enrollment has already been approved.

import json
import os
import urllib.error
import urllib.request

API = "https://api.rovela.dev/emails"


def send_email(to, subject, html, text, idempotency_key, from_address, tags):
    payload = {
        "from": f"Registrar <{from_address}>",
        "to": to,
        "subject": subject,
        "html": html,
        "text": text,
        "reply_to": from_address,
        "tags": tags,
    }
    req = urllib.request.Request(
        API,
        data=json.dumps(payload).encode(),
        method="POST",
        headers={
            "Authorization": f"Bearer {os.environ['ROVELA_API_KEY']}",
            "Content-Type": "application/json",
            "Idempotency-Key": idempotency_key,
        },
    )
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            body = json.loads(resp.read().decode())
    except urllib.error.HTTPError as exc:
        raise RuntimeError(f"Rovela send failed: HTTP {exc.code}") from exc
    return body.get("id") or ""


def notify_enrollment_approved(student_email, course_name, course_permalink, enrollment_id):
    safe_name = (
        course_name.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
    )
    return send_email(
        to=student_email,
        subject="Your course enrollment was approved",
        html=(
            f"<p>Your enrollment in “{safe_name}” was approved.</p>"
            f'<p><a href="{course_permalink}">Open the course</a></p>'
        ),
        text=(
            f'Your enrollment in "{course_name}" was approved.\n\n'
            f"Open the course: {course_permalink}"
        ),
        idempotency_key=f"enrollment-approved-{enrollment_id}",
        from_address="courses@yourdomain.com",
        tags={"type": "enrollment_approved"},
    )

Call notify_enrollment_approved from the LTI tool, event subscription handler, or background worker that already wrote approved_at (or your own “approved and usable” flag) — after the course permalink exists and remains reachable by that student, not before. A typical pattern is an event handler that listens for your own “enrollment approved” record after it is persisted, or a worker that drains an enrollment_approved queue your handler already enqueued. Keep the HTTP call out of the request path that merely submits an enrollment request; the student should be mailed when the enrollment has actually been approved, not when they first apply. The email is a status notice, not a place to dump a complete syllabus, a seating chart, or every upcoming assignment the student can already read once they open the course. If a later decision drops the enrollment, that is a different event and should use a different idempotency key — do not reuse the approved key, and do not treat this mail as a Moodle assignment-graded notice.

If several enrollments are approved in a short window and you genuinely need one HTTP call per batch of notices, POST /emails/batch accepts up to 100 messages and rejects template and topic_id. Most LMS workflows are better served by one idempotent POST /emails per enrollment. topic_id is only a documented field on the single-send endpoint; this guide does not walk through a topics product.

Idempotency, recipients, and what a 200 actually means

LTI tools and background workers retry, and an “the enrollment was approved, notify the student” path can run more than once for the same record. Send an Idempotency-Key header (up to 256 characters). A retry of the same request within 24 hours returns the original response instead of sending again (idempotency). Key it to the enrollment id (or to a specific approved event id you already store), not to the clock and not to the student’s email alone. If the same address later enrolls in a different course that is also approved, that is a second notice and a second key.

A message may address at most 50 recipients across to, cc, and bcc combined. That is the transport’s limit, not a plan limit, and it is checked before the request is accepted. Quota is charged per recipient, not per message — cc and bcc count the same as to (cc and bcc). An enrollment-approved notice addresses the student whose enrollment was just approved. If a second contact also has to be told, add that address deliberately and accept that it counts as a second recipient. Do not cc every instructor or the entire section by default.

HTTP 200 from POST /emails means the message was accepted and queued. It is not a delivery receipt. The JSON is {"object":"email","id":"..."}. Persist that id next to the enrollment record if you want to look the message up later from a dashboard session. Do not block the LTI tool or worker until a mailbox provider confirms delivery.

scheduled_at is a documented ISO 8601 future timestamp if you ever need to hold a notice (scheduled email). For an enrollment that is already approved, send immediately after the approved record is written. If you did schedule a message and the student should not receive it, POST /emails/:id/cancel cancels an unsent message. Reading, cancelling, and any rescheduling need full_access or a dashboard session. This article does not invent a reschedule request body. Attachments, when you have a genuine reason to include one, use { filename, content, content_type } with content as base64; an enrollment-approved notice rarely needs a file.

Errors you should handle in the Canvas worker

Documented send errors use an envelope of { statusCode, name, message }:

  • 400 — a missing required field, a from domain that does not belong to your organization, a template that does not exist, or more than 50 recipients on one message. Fix the payload; retrying the same body will fail the same way.
  • 401 — a missing, malformed, or revoked Bearer key. Check the process environment, not the enrollment row.
  • 429 — you are being rate limited. Back off and retry with the same Idempotency-Key so a later attempt cannot send a second notice for the same approval (rate limits, retries).

Treat unknown 5xx responses as retryable with the same key. Log name and message next to the enrollment id; do not log the Bearer key. A practical walk-through is the email API error handling guide. Related operational reading includes email API logs and email API integration.

Delivery is asynchronous — do not poll from the worker

A 200 from POST /emails means accepted for delivery, not delivered. Reading GET /emails/:id or GET /emails/:id/events needs a full_access key or a dashboard session; a sending_access key cannot do it, and you should not add a polling loop inside the LTI tool or background worker. Subscribe to a webhook instead, and verify the signature header x-resend-signature as documented in webhook security and signature verification. Event names include accepted, delivered, opened, clicked, bounced, or failed. For a single message you can also use the email delivery status API or the dashboard from a support session. Related reading includes the email webhooks API and transactional email webhooks.

A generic assignment-graded or data-export-ready notice is a different tutorial; a Canvas worker posts an enrollment-approved notice with the course permalink using POST /emails

What not to do in this enrollment-approved notice

  • Do not put the Rovela key in a browser client, a public repository, a Canvas theme, or a container image.
  • Do not invent a Rovela Canvas plugin that enrolls students or approves enrollments. Your LTI tool or worker already recorded the approval; Rovela delivers the mail. There is no official client library. Rovela is not changing enrollment status.
  • Do not send this as an “your assignment was graded,” “your data export is ready,” or “your forum account was approved” template borrowed from another tutorial. The permalink is a course home the student can now open, and the recipient is that student.
  • Do not include identity documents, student numbers that you would not already show on the course home, password material, or a dump of private registrar notes in the email body. The notice carries a short course name and the permalink.
  • Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. An LTI tool or background worker should use the HTTP API. Inbound mail into a hosted mailbox is a different path, described in the webmail manual; this guide is an outbound enrollment-approved notice. If you are migrating an older mailer, see migrate SMTP to the Email API and SMTP ports 25, 465, and 587.
  • Do not poll GET /emails/:id with a sending_access key, and do not invent a reschedule body if you later cancel an unsent message.

A compact enrollment-approved checklist

  1. Verify the sending domain and create a sending_access key (Quick Start).
  2. Put ROVELA_API_KEY and ROVELA_FROM in the LTI tool or worker’s process environment, not in a front-end script.
  3. Record the approved enrollment first: the student’s address, a short course name, and the course permalink they already have.
  4. Call POST /emails with a Python HTTP client (or curl), both html and text, a reply_to if you want replies in a registrar inbox, and an Idempotency-Key scoped to that enrollment id.
  5. Treat HTTP 200 as accepted, not delivered. Persist the returned message id if you need it later.
  6. Confirm delivery with a signed webhook or from the dashboard.
  7. If you are comparing providers, the existing pages are Rovela vs Mailgun, vs Amazon SES, vs Postmark, vs SendGrid, vs Resend, and vs Brevo. For the HTTP shape itself, see the transactional email API, the curl sending guide, and the HTTP email API overview. For other notification patterns, see the email notification API guide.