- Prevent threading on Gmail with the
X-Entity-Ref-IDheader (Example) - Include a shortcut for users to unsubscribe with the
List-Unsubscribeheader (Example)
import { Emailr } from 'emailr';
const emailr = new Emailr('em_xxxxxxxxx');
await emailr.emails.send({
from: 'Acme <[email protected]>',
to: ['[email protected]'],
subject: 'hello world',
html: '<p>it works!</p>',
headers: {
'X-Entity-Ref-ID': 'xxx_xxxx',
},
});
$emailr = Emailr::client('em_xxxxxxxxx');
$emailr->emails->send([
'from' => 'Acme <[email protected]>',
'to' => ['[email protected]'],
'subject' => 'hello world',
'html' => '<p>it works!</p>',
'headers' => [
'X-Entity-Ref-ID' => 'xxx_xxxx',
]
]);
import emailr
emailr.api_key = "em_xxxxxxxxx"
params: emailr.Emails.SendParams = {
"from": "[email protected]",
"to": ["[email protected]"],
"subject": "hi",
"html": "<p>it works!</p>",
"headers": {
"X-Entity-Ref-ID": "xxx_xxxx"
}
}
email = emailr.Emails.send(params)
print(email)
require "emailr"
Emailr.api_key = "em_xxxxxxxxx"
params = {
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "hello world",
"html": "<p>it works!</p>",
"headers": {
"X-Entity-Ref-ID": "123"
},
}
sent = Emailr::Emails.send(params)
puts sent
import (
"fmt"
"github.com/emailr/emailr-go/v3"
)
func main() {
ctx := context.TODO()
client := emailr.NewClient("em_xxxxxxxxx")
params := &emailr.SendEmailRequest{
From: "Acme <[email protected]>",
To: []string{"[email protected]"},
Subject: "hello world",
Html: "<p>it works!</p>",
Headers: map[string]string{
"X-Entity-Ref-ID": "xxx_xxxx",
}
}
sent, err := client.Emails.SendWithContext(ctx, params)
if err != nil {
panic(err)
}
fmt.Println(sent.Id)
}
use emailr_rs::types::{Attachment, CreateEmailBaseOptions, Tag};
use emailr_rs::{Emailr, Result};
#[tokio::main]
async fn main() -> Result<()> {
let emailr = Emailr::new("em_xxxxxxxxx");
let from = "Acme <[email protected]>";
let to = ["[email protected]"];
let subject = "hello world";
let email = CreateEmailBaseOptions::new(from, to, subject)
.with_html("<p>it works!</p>")
.with_header("X-Entity-Ref-ID", "xxx_xxxx");
let _email = emailr.emails.send(email).await?;
Ok(())
}
import com.emailr.*;
public class Main {
public static void main(String[] args) {
Emailr emailr = new Emailr("em_xxxxxxxxx");
CreateEmailOptions params = CreateEmailOptions.builder()
.from("Acme <[email protected]>")
.to("[email protected]")
.subject("hello world")
.html("<p>it works!</p>")
.headers(Map.of(
"X-Entity-Ref-ID", "xxx_xxxx"
))
.build();
CreateEmailResponse data = emailr.emails().send(params);
}
}
using Emailr;
using System.Collections.Generic;
IEmailr emailr = EmailrClient.Create( "em_xxxxxxxxx" ); // Or from DI
var message = new EmailMessage()
{
From = "Acme <[email protected]>",
To = "[email protected]",
Subject = "hello world",
HtmlBody = "<p>it works!</p>",
Headers = new Dictionary<string, string>()
{
{ "X-Entity-Ref-ID", "xxx_xxxx" },
},
};
var resp = await emailr.EmailSendAsync( message );
Console.WriteLine( "Email Id={0}", resp.Content );
curl -X POST 'https://api.emailr.dev/emails' \
-H 'Authorization: Bearer em_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d $'{
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "hello world",
"html": "<p>it works!</p>",
"headers": {
"X-Entity-Ref-ID": "xxx_xxxx"
}
}'