Building with .NET, Rust, Elixir or Symfony? You can now connect Lettermint to your application with an official SDK. Install it and you're sending transactional emails and broadcast emails with just a few lines of code.
You may already know the community packages for .NET, Elixir and Symfony. Those still work fine. The difference is that we maintain the official SDKs ourselves, so every new Lettermint feature lands in them too.
Send email with .NET and C#
The .NET SDK is available on NuGet and requires .NET 8 or newer. Make sure you pick Lettermint. The community SDK by ExciteOrg (opens in a new window) goes by LettermintDotNet.
Sending your first email looks like this:
using Lettermint;
using var email = LettermintClient.Email("lm_project_token");
var response = await email
.From("sender@acme.com")
.To("recipient@acme.com")
.Subject("Hello from Lettermint")
.Html("<p>Hello World!</p>")
.SendAsync();
Attachments and the Team API are covered in the .NET guide.
The Rust SDK is now official
Franz Geffke (opens in a new window) wrote the first version of the Rust SDK. We've since taken over maintenance and shipped version 1.0, which now works like the rest of our SDKs. The crate is still called lettermint on crates.io. You'll need Rust 1.98 or newer and an async runtime like Tokio.
Here's what sending an email looks like in 1.0:
use lettermint::Lettermint;
#[tokio::main]
async fn main() -> lettermint::Result<()> {
let email = Lettermint::email("lm_project_token")?;
email
.email()
.from("sender@acme.com")
.to("recipient@acme.com")
.subject("Hello from Lettermint")
.html("<p>Hello World!</p>")
.send()
.await?;
Ok(())
}
Already on the Rust SDK? If your Cargo.toml pins lettermint = "0.3", nothing changes for you. Before you upgrade to 1.0, check the migration guide (opens in a new window). The Rust guide has all the options.
Transactional emails from Elixir and Phoenix
The Elixir SDK is on Hex and supports Elixir 1.15 and up. It works in any Mix project, Phoenix apps included. You build an email one step at a time:
alias Lettermint.EmailBuilder, as: Email
client = Lettermint.email("lm_project_token")
client
|> Email.new()
|> Email.from("sender@acme.com")
|> Email.to(["recipient@acme.com"])
|> Email.subject("Hello from Lettermint")
|> Email.html("<p>Hello World!</p>")
|> Email.send()
If you send mail through Swoosh, keep using the Lettermint adapter (opens in a new window). The SDK doesn't replace it. Add the SDK when you also want to call the Team API or verify webhooks. You'll find more examples in the Elixir guide.
Connect Lettermint to Symfony Mailer
For Symfony Mailer, install lettermint/symfony-mailer with Composer. It needs PHP 8.2 and Symfony Mailer 6.4, 7.4 or 8. A community integration by somehow digital (opens in a new window) already existed, and you can keep using it.
After installing, register the integration once in config/services.yaml and add your project API token to the DSN:
MAILER_DSN=lettermint+api://lm_project_token@default
That's it. You keep sending email through MailerInterface like you always did, without changing your code. Emails you queue with Symfony Messenger go through Lettermint as well. The Symfony guide walks you through the registration step.
All official SDKs at a glance
The .NET, Rust and Elixir SDKs do more than send email. You can also use them to manage domains and projects through the Team API and to verify webhook signatures.
That brings our official SDKs and integrations to Node.js, Nuxt, PHP, Laravel, Symfony, Python, Go, Java, .NET, Elixir and Rust. Every email you send with them is processed in the EU. You can find them all on our integrations page.