SendGrid Mailer

Lightweight Azure Functions endpoint that delivers email through the SendGrid API. Useful for notifications, test emails, and scripted delivery with optional attachments.

Brought to you by the Online team

Typical API response

HTTP 200 · application/json

{"status":"sent","messageId":"abc123..."}

Each successful request delivers one email via SendGrid.

Endpoints

POST /api/contact

Public contact-form endpoint for static sites. Uses honeypot validation, optional Origin allowlist, and fixed to/from addresses.

POST /api/sendmail?code=<function-key>

General mail API for trusted callers. Requires function-level authentication (authLevel: function).

About

The API sends email using the Node.js @sendgrid/mail SDK (api.sendgrid.com by default). The SendGrid API key is stored server-side — static sites call /api/contact only and never receive mail credentials.

/api/sendmail supports to, from, subject, contentHtml, contentText, and attachments. /api/contact accepts name, email, subject, message, and honeypot website.

Usage notes

Try it

curl -X POST "http://localhost:7071/api/contact" \
  -H "Content-Type: application/json" \
  -H "Origin: http://localhost:7071" \
  -d '{"name":"Test","email":"test@example.com","subject":"Hi","message":"Hello","website":""}'

Team

Maintained by the Online team at Louwman ICT Services. Questions or feedback? Contact online@louwmanictservices.nl.

Changelog

1.1.0

17 July 2026

  • Added public /api/contact endpoint for static-site contact forms
  • Locked /api/sendmail behind function-key authentication
  • Added honeypot, Origin allowlist, and Reply-To support for contact submissions

1.0.0

15 July 2026

  • Added HTTP-triggered Azure Function that sends email via SendGrid API
  • Added splash page, health check endpoint, and deployment pipeline automation
  • Added test payload template with optional attachment support