lizard-cloud-functions
v1.0.1
Published
Lizard Global Backend Functions
Downloads
3
Readme
Lizard Cloud Functions
Server side helper functions
Example?
Send email using sendgrid
import {sendEmail} from 'lizard-cloud-functions' //import sendEmail function
---
**NOTE**
Please define smtp config in one file and use it as import. So for any reason if needed to be changed then it has to be changed at one place and good to go
---
const data = {
smtpConfig: {
host: 'smtp.sendgrid.net',
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: 'apikey',
pass: //your sendgrid API key
}
},
subject: 'Test email',
html: '<h1>HTML for Text email</h1>',
to: //email address whom you want to send email
from: //from which email address you want to send email
}
sendEmail(data)
.then((data) => {
res.status(200).send(data);
})
.catch( (err) =>{
res.status(400).send(err);
})