@247studios/contact
v2.0.1
Published
Serverless function to send mail.
Downloads
17
Readme
@247studios/contact
Netlify Function generator that sends an email using SendGrid.
npm install @247studios/contact
Usage
const contact = require('@247studios/contact');
exports.handler = contact({
from: '[email protected]',
to: '[email protected]',
subject: 'Operation - Leave Request',
redirectSuccess: 'http://example.com',
redirectError: 'http://example.com',
provider: 'sendgrid',
template: ({
name,
email,
message,
}) => `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
${name} <${email}> says:
<br>
${message}
</body>
</html>`,
});
Environment Variables
| | |
|-|-|
| RECAPTCHA_SECRET
| https://developers.google.com/recaptcha |
| SENDGRID_API_KEY
| https://sendgrid.com/docs/ui/account-and-settings/api-keys/ |
When deploying to Netlify, set the Build Environment Variables.
Releasing New Versions
Specify semantic version change by running one of npm version patch
,
npm version minor
, or npm version major
.
Once commit reaches the master
branch on GitLab, the release will be deployed
to npm automatically.