Starting to setup emails
This commit is contained in:
parent
1c239f161b
commit
d0de943df2
BIN
db.sqlite-shm
BIN
db.sqlite-shm
Binary file not shown.
BIN
db.sqlite-wal
BIN
db.sqlite-wal
Binary file not shown.
|
|
@ -124,7 +124,13 @@ export default defineNuxtConfig({
|
|||
session: {
|
||||
password: '699c46bd-9aaa-4364-ad01-510ee4fe7013'
|
||||
},
|
||||
database: 'db.sqlite'
|
||||
database: 'db.sqlite',
|
||||
mail: {
|
||||
host: '',
|
||||
port: '',
|
||||
user: '',
|
||||
passwd: '',
|
||||
}
|
||||
},
|
||||
security: {
|
||||
rateLimiter: false,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"hast": "^1.0.0",
|
||||
"lodash.capitalize": "^4.2.1",
|
||||
"mdast-util-find-and-replace": "^3.0.1",
|
||||
"nodemailer": "^6.9.16",
|
||||
"nuxt": "^3.14.159",
|
||||
"nuxt-security": "^2.0.0",
|
||||
"radix-vue": "^1.9.8",
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
"devDependencies": {
|
||||
"@types/bun": "^1.1.12",
|
||||
"@types/lodash.capitalize": "^4.2.9",
|
||||
"@types/nodemailer": "^6.4.16",
|
||||
"@types/unist": "^3.0.3",
|
||||
"better-sqlite3": "^11.5.0",
|
||||
"bun-types": "^1.1.34",
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ async function fetch()
|
|||
<Select label="Job" v-model="job">
|
||||
<SelectItem label="Récupérer les données d'Obsidian" value="pull" />
|
||||
<SelectItem label="Envoyer les données dans Obsidian" value="push" disabled />
|
||||
<SelectItem label="Envoyer un mail de test" value="mail" />
|
||||
</Select>
|
||||
<Button class="self-center" @click="() => !!job && fetch()" :loading="status === 'pending'">
|
||||
<span>Executer</span>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
import * as nodemailer from 'nodemailer';
|
||||
|
||||
export default defineTask({
|
||||
meta: {
|
||||
name: 'mail',
|
||||
description: 'Send email',
|
||||
},
|
||||
async run(e) {
|
||||
try {
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
const transport = nodemailer.createTransport({
|
||||
pool: true,
|
||||
host: config.mail.host,
|
||||
port: config.mail.port,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: config.mail.user,
|
||||
pass: config.mail.passwd,
|
||||
},
|
||||
tls: {
|
||||
rejectUnauthorized: false,
|
||||
}
|
||||
});
|
||||
|
||||
transport.verify((error) =>{
|
||||
if (error)
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
await transport.sendMail({
|
||||
sender: 'no-reply@peaceultime.com',
|
||||
to: 'clem31470@gmail.com',
|
||||
text: 'Ceci est un texte de mail.',
|
||||
subject: 'Test',
|
||||
});
|
||||
|
||||
return { result: true };
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return { result: false, error: e };
|
||||
}
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue