Connect to MailerSend and dispatch email

The mission is to send an email using a template in MailerSend when a new row is inserted into a SQL Server table.

Although n8n does not have an existing trigger when a new record is inserted into a SQL Server table, I have overcome this issue by executing a query looking for new records at INTERVAL.

That said is there a connection string to MailerSend, preferably to an existing template, and if not is there a work-around?
Thank you
Anthony

Hi @AJS, we don’t have a pre-built node for MailerSend, but from looking at their website they appear to offer an SMTP relay. So, you could just use the existing Send Email node allowing you to connect to SMTP servers.

Unfortunately I cannot use a Mailersend template when using their SMTP relay.

I believe that I have a node.js template (below). Can I set this up as a new node in n8n, and if so is there either a template or instruction. If it is not possible to set it up in node.js is there another language (php, cURL, Ruby, Pytho etc…)

const Recipient = require(“mailersend”).Recipient;
const EmailParams = require(“mailersend”).EmailParams;
const MailerSend = require(“mailersend”);

const mailersend = new MailerSend({
api_key: “key”,
});

const recipients = [new Recipient(“[email protected]”, “Your Client”)];

const personalization = [
{
email: “[email protected]”,
data: {
fname: ‘’,
qsval: ‘’,
unsub: ‘’
},
}
];

const emailParams = new EmailParams()
.setFrom(“[email protected]”)
.setFromName(“Your Name”)
.setRecipients(recipients)
.setSubject(“Subject”)
.setTemplateId(‘z3m5jgroznmgdpyo’)
.setPersonalization(personalization);

mailersend.send(emailParams);