Add emails #389

Merged
Irev-Dev merged 2 commits from kurt/388-email into main 2021-06-29 09:07:32 +02:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 98d1b0643d - Show all commits

View File

@@ -3,6 +3,7 @@ import { db } from 'src/lib/db'
import { sentryWrapper } from 'src/lib/sentry'
import { enforceAlphaNumeric, generateUniqueString } from 'src/services/helpers'
import 'graphql-tag'
import {sendMail} from 'src/lib/sendmail'
const unWrappedHandler = async (req, _context) => {
const body = JSON.parse(req.body)
@@ -73,6 +74,15 @@ const unWrappedHandler = async (req, _context) => {
id: user.id,
}
await createUserInsecure({ input })
await sendMail({
to: 'k.hutten@protonmail.ch',
from: {
address:'news@mail.cadhub.xyz',
name: 'CadHub',
},
subject: `New Cadhub User`,
text: JSON.stringify(input, null, 2),
})
return {
statusCode: 200,

View File

@@ -9,10 +9,18 @@ export const sendAllUsersEmail = async ({input: {body, subject}}) => {
address:'news@mail.cadhub.xyz',
name: 'CadHub',
}
return sendMail({
const result = await sendMail({
to: recipients,
from,
subject,
text: body,
})
await sendMail({
to: 'k.hutten@protonmail.ch',
from,
subject: `All users email report`,
text: JSON.stringify(result, null, 2),
})
return result
}