stuff done
This commit is contained in:
44
actions/admin/mailer.ts
Normal file
44
actions/admin/mailer.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
'use server'
|
||||
|
||||
import nodemailer from 'nodemailer'
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'smtp.gmail.com',
|
||||
port: 465,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: 'vista@ugmail.org',
|
||||
pass: 'hqhowacppifsefxl'
|
||||
}
|
||||
})
|
||||
|
||||
type SendMailProps = {
|
||||
email: string
|
||||
subject: string
|
||||
text: string
|
||||
html: string
|
||||
}
|
||||
|
||||
export async function sendMail({email, subject, text, html}: SendMailProps) {
|
||||
try {
|
||||
const info = await transporter.sendMail({
|
||||
from: `"BeWell" <vista@ugmail.org>`,
|
||||
to: email,
|
||||
bcc: [
|
||||
'yevhen.odynets@gmail.com',
|
||||
'shopping@amok.space',
|
||||
{
|
||||
name: 'Actus Septem',
|
||||
address: 'actus.septem@ukr.net'
|
||||
}
|
||||
],
|
||||
subject,
|
||||
text,
|
||||
html
|
||||
})
|
||||
|
||||
return {ok: true, messageId: info.messageId}
|
||||
} catch (e) {
|
||||
return {ok: false, message: JSON.stringify(e)}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user