Hi @filip @Thomas I tried the SendGrid approach several times, but no email were sent and no error after calling the Moralis cloud function.
I generated the SendGrid API key with email sending permission as in the video updated to the latest server 0.0235.
Here are my cloud functions, but neither of them were working:
Moralis.Cloud.define("sendWelcomeEmail", (request) => {
Moralis.Cloud.sendEmail({
// Hardcoded from https://temp-mail.org/
to: '[email protected]',
templateId: "d-84e646524eb54d64944182a456f4c0e0",
dynamic_template_data: {
name: request.params.name,
},
});
});
Moralis.Cloud.define("sendEmailToUser", (request) => {
Moralis.Cloud.sendEmail({
to: '[email protected]',
subject: "Fundamentals",
html: "Pampamentally it does make sense https://youtu.be/xXrkgWDcd7c",
});
});
and the cloud function call:
async sendWelcome() {
try {
let cloudResponse = await Moralis.Cloud.run('sendWelcomeEmail', {
email: '[email protected]',
name: this.testUserName,
});
cloudResponse = await Moralis.Cloud.run('sendEmailToUser', {
email: '[email protected]',
name: this.testUserName,
});
console.info('User welcome email success:', cloudResponse);
} catch (error) {
console.error(
'User welcome email error:' + error.code + ' ' + error.message
);
}
}
The console output was: User welcome email success: undefined
and no email were sent.
Thanks for all your hints and help in this in advance.