Official Veil Mail SDK for Unity. Send transactional and marketing emails with automatic PII protection directly from your Unity projects.
Veil Mail is the only email API with a first-class Unity SDK. Resend, SendGrid, Mailgun, and Postmark offer no official Unity support — you have to build it yourself with
UnityWebRequestand hope your rate-limits and error handling don't break in production. This SDK gives you full API coverage, bothasync/awaitand coroutine APIs, editor tools, and aScriptableObjectconfig with build-time API key stripping.Common use cases in games: email verification, password reset, receipts and invoices, player re-engagement campaigns, live-ops announcements, tournament notifications, and transactional flows from game servers or standalone builds (including WebGL and mobile).
Other Veil Mail SDKs: Unreal Engine · TouchDesigner · Node.js · Python · Go · 11 more
The VeilMail Unity SDK provides full access to the Veil Mail API from Unity 2021.3 and later. It uses UnityWebRequest under the hood for cross-platform compatibility (Editor, Standalone, Mobile, WebGL) and offers both async/await and coroutine APIs.
- Full API coverage: Emails, Domains, Templates, Audiences, Campaigns, Webhooks, Topics, Properties, Sequences, Feeds, Forms, Analytics
- Dual API: async/await for modern C# and coroutine helpers for MonoBehaviour workflows
- Editor tools: Project Settings panel for configuration, Test Email window for quick testing
- VeilMailConfig ScriptableObject with automatic API key stripping for builds
- Webhook signature verification
- Cross-platform support via UnityWebRequest (no System.Net.Http dependency)
- Zero external dependencies -- includes a built-in lightweight JSON parser
- Open Unity and go to Window > Package Manager.
- Click the + button in the top-left corner.
- Select Add package from git URL...
- Enter the following URL:
https://github.com/Resonia-Health/veilmail-unity.git
- Click Add.
- Clone or download this repository.
- Copy the
packages/sdk-unityfolder into your Unity project'sPackages/directory. - Rename it to
xyz.veilmail.sdk.
Go to Edit > Project Settings > VeilMail and enter your API key. You can obtain an API key from the VeilMail Dashboard.
using System.Collections.Generic;
using UnityEngine;
using VeilMail;
public class EmailSender : MonoBehaviour
{
async void Start()
{
var client = VeilMailClient.FromSettings();
var result = await client.Emails.SendAsync(new Dictionary<string, object>
{
["from"] = "hello@yourdomain.com",
["to"] = "user@example.com",
["subject"] = "Hello from Unity!",
["html"] = "<h1>Welcome!</h1><p>Sent from Unity.</p>",
});
Debug.Log($"Email sent! ID: {result["id"]}");
}
}using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VeilMail;
using VeilMail.Utilities;
public class EmailSenderCoroutine : MonoBehaviour
{
IEnumerator Start()
{
var client = VeilMailClient.FromSettings();
yield return client.Emails.SendAsync(new Dictionary<string, object>
{
["from"] = "hello@yourdomain.com",
["to"] = "user@example.com",
["subject"] = "Hello from Unity!",
["html"] = "<h1>Welcome!</h1>",
}).AsCoroutine<Dictionary<string, object>>(
onSuccess: result => Debug.Log($"Sent! ID: {result["id"]}"),
onError: ex => Debug.LogError($"Failed: {ex.Message}")
);
}
}Navigate to Edit > Project Settings > VeilMail to configure:
- API Key -- Your Veil Mail API key (masked by default).
- Base URL -- API endpoint (default:
https://api.veilmail.xyz). - Timeout -- Request timeout in seconds (default: 30).
- Strip API Key in Builds -- When enabled (default), the API key is removed from build artifacts for security.
- Test Connection -- Verify your API key works with a single click.
Go to Tools > VeilMail > Send Test Email to open a window where you can send test emails directly from the editor without writing any code.
Important: Never ship builds with your API key embedded. The SDK includes a stripKeyInBuilds option (enabled by default) that removes the API key from VeilMailConfig when building.
For production builds, use the Server Proxy pattern: run a lightweight server that holds your API key and have the Unity client communicate through it. See the Server Proxy sample for a complete example.
Refer to Documentation~/SECURITY.md for full security guidance.
All resources are accessed through the VeilMailClient instance:
| Resource | Methods |
|---|---|
client.Emails |
SendAsync, GetAsync, ListAsync, CancelAsync |
client.Domains |
ListAsync, GetAsync, CreateAsync, VerifyAsync, DeleteAsync |
client.Templates |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Audiences |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync, Subscribers (sub-resource) |
client.Campaigns |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync, SendAsync, ScheduleAsync |
client.Webhooks |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Topics |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Properties |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Sequences |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync, ActivateAsync, PauseAsync |
client.Feeds |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Forms |
ListAsync, GetAsync, CreateAsync, UpdateAsync, DeleteAsync |
client.Analytics |
GetOverviewAsync, GetEmailStatsAsync, GetCampaignStatsAsync |
All methods return Task<Dictionary<string, object>> and can be used with both async/await and coroutines (via the AsCoroutine extension method).
using VeilMail.Webhook;
bool isValid = WebhookVerifier.Verify(payload, signature, webhookSecret);Import samples via Window > Package Manager > VeilMail SDK > Samples:
- Basic Email -- Minimal email sending example.
- Template Email -- Sending emails using templates with dynamic data.
- Server Proxy -- Secure proxy pattern for shipped builds (recommended for production).
- Unity 2021.3 or later
- .NET Standard 2.1 or .NET Framework 4.x scripting backend
- Documentation: https://veilmail.xyz/docs/sdk-unity
- Issues: https://github.com/Resonia-Health/veilmail-unity/issues
- Email: support@veilmail.xyz
MIT License. See LICENSE for details.