Skip to content

Commit ce8204b

Browse files
committed
fix: cannot send email
1 parent f6a3018 commit ce8204b

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

nuxt.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ export default defineNuxtConfig({
2121
},
2222

2323
nodemailer: {
24-
secure: false,
24+
secure: Boolean(process.env.SMTP_USER && process.env.SMTP_PASS),
2525
from: process.env.SMTP_FROM,
2626
host: process.env.SMTP_SERVER,
2727
port: Number(process.env.SMTP_PORT),
28+
auth: process.env.SMTP_USER && process.env.SMTP_PASS
29+
? {
30+
user: process.env.SMTP_USER,
31+
pass: process.env.SMTP_PASS,
32+
}
33+
: undefined,
2834
},
2935

3036
nitro: {
@@ -242,6 +248,12 @@ export default defineNuxtConfig({
242248
tasks: true,
243249
},
244250

251+
tasks: {
252+
'email:test': {
253+
description: 'Test email sending',
254+
},
255+
},
256+
245257
devProxy: {
246258
host: 'localhost',
247259
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thecodeorigin/nuxt",
33
"type": "module",
4-
"version": "2.7.0",
4+
"version": "2.7.1",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",
77
"access": "public"

server/tasks/email/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineTask({
88

99
await sendMail({
1010
subject: 'Hehe test',
11-
11+
1212
html: 'This is a test email',
1313
})
1414

0 commit comments

Comments
 (0)