a Contact Form for @magic also includes a server lambda that sends emails via smtp
npm install --save-exact @magic-modules/contact
// assets/index.js:
const Contact = require('@magic-modules/contact')
module.exports = {
//... other entries
Contact,
}
configuration includes multiple files.
refer to the now.sh docs for more information
// /now.json
{
"env": [
"SMTP_USER",
"SMTP_PASS"
]
}
// /now-required.json
{
"SMTP_USER": "@smtp-user",
"SMTP_PASS": "@smtp-pass",
"SMTP_HOST": "smtp.gmail.com"
}
// /now-secrets.json
// !add file to .gitignore
{
"@smtp-user": "your@gmail.com",
"@smtp-pass": "password"
}
// in any component view
const component = {
View: () => Contact()
}