docs/platform/integrations/email/mailersend.mdx
MailerSend is an email delivery service that allows you to send emails from your application.
To use the MailerSend provider in the email channel, you will need to create a MailerSend account and add your API key to the MailerSend integration on the Novu platform. To generate the API token go visit the MailerSend API Tokens page.
Disabled button and mark it as Active.Novu has its own email editor for writing email template. If you want to use pre made template from MailerSend, you can use customData filed of email overrides to send template details. Make sure your Api Key has enough permission to read and process the template.
const novu = new Novu({ secretKey: "<NOVU_SECRET_KEY>" });
await novu.trigger({ workflowId: "workflowId", to: { subscriberId: "subscriberId", }, payload: {}, overrides: { "email": { "customData": { "templateId": "mailersend-template-id", "personalization": [ { "email": "[email protected]", "data": { "items": { "price": "", "product": "", "quantity": "" } } } ] } } }, });
</Tab>
<Tab title="Python">
```python
import os
import novu_py
from novu_py import Novu
with Novu(secret_key=os.getenv("NOVU_SECRET_KEY", "")) as novu:
novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
workflow_id="workflowId",
to={"subscriber_id": "subscriberId"},
payload={},
overrides={
"email": {
"customData": {
"templateId": "mailersend-template-id",
"personalization": [
{
"email": "[email protected]",
"data": {
"items": {
"price": "",
"product": "",
"quantity": ""
}
}
}
]
}
}
},
))
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
)
s := novugo.New(novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")))
res, err := s.Trigger(context.Background(), components.TriggerEventRequestDto{ WorkflowID: "workflowId", To: components.CreateToSubscriberPayloadDto(components.SubscriberPayloadDto{ SubscriberID: "subscriberId", }), Payload: map[string]any{}, Overrides: map[string]any{ "email": { "customData": { "templateId": "mailersend-template-id", "personalization": [ { "email": "[email protected]", "data": { "items": { "price": "", "product": "", "quantity": "" } } } ] } } }, }, nil)
</Tab>
<Tab title="PHP">
```php
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()->setSecurity('<NOVU_SECRET_KEY>')->build();
$sdk->trigger(
triggerEventRequestDto: new Components\TriggerEventRequestDto(
workflowId: 'workflowId',
to: new Components\SubscriberPayloadDto(subscriberId: 'subscriberId'),
payload: {},
overrides: {
"email": {
"customData": {
"templateId": "mailersend-template-id",
"personalization": [
{
"email": "[email protected]",
"data": {
"items": {
"price": "",
"product": "",
"quantity": ""
}
}
}
]
}
}
},
),
);
var sdk = new NovuSDK(secretKey: "<NOVU_SECRET_KEY>");
await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() { WorkflowId = "workflowId", To = To.CreateSubscriberPayloadDto(new SubscriberPayloadDto() { SubscriberId = "subscriberId" }), Payload = {}, Overrides = { "email": { "customData": { "templateId": "mailersend-template-id", "personalization": [ { "email": "[email protected]", "data": { "items": { "price": "", "product": "", "quantity": "" } } } ] } } }, });
</Tab>
<Tab title="Java">
```java
import co.novu.Novu;
import co.novu.models.components.*;
Novu novu = Novu.builder().secretKey("<NOVU_SECRET_KEY>").build();
novu.trigger()
.body(TriggerEventRequestDto.builder()
.workflowId("workflowId")
.to(To2.of(SubscriberPayloadDto.builder().subscriberId("subscriberId").build()))
.payload({})
.overrides({
"email": {
"customData": {
"templateId": "mailersend-template-id",
"personalization": [
{
"email": "[email protected]",
"data": {
"items": {
"price": "",
"product": "",
"quantity": ""
}
}
}
]
}
}
})
.build())
.call();