mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 22:08:02 +00:00
create nodemailer
This commit is contained in:
parent
e3843f842a
commit
8d6c754bbd
6 changed files with 74 additions and 0 deletions
6
nodemailer/README.md
Normal file
6
nodemailer/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
```
|
||||||
|
docker compose up -d
|
||||||
|
# http://localhost:8025 にアクセスして確認
|
||||||
|
pnpm i
|
||||||
|
node index.mjs
|
||||||
|
```
|
19
nodemailer/compose.yml
Normal file
19
nodemailer/compose.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
services:
|
||||||
|
# maildev:
|
||||||
|
# image: maildev/maildev
|
||||||
|
# ports:
|
||||||
|
# - "1080:1080" # Web UI
|
||||||
|
# - "1025:1025"
|
||||||
|
# environment:
|
||||||
|
# MAILDEV_INCOMING_USER: postmaster
|
||||||
|
# MAILDEV_INCOMING_PASS: password
|
||||||
|
mailpit:
|
||||||
|
image: axllent/mailpit
|
||||||
|
ports:
|
||||||
|
- "8025:8025" # Web UI
|
||||||
|
- "1025:1025"
|
||||||
|
environment:
|
||||||
|
MP_SMTP_AUTH_FILE: /etc/mailpit/auth
|
||||||
|
MP_SMTP_AUTH_ALLOW_INSECURE: "true"
|
||||||
|
volumes:
|
||||||
|
- ./etc/mailpit:/etc/mailpit:ro
|
1
nodemailer/etc/mailpit/auth
Normal file
1
nodemailer/etc/mailpit/auth
Normal file
|
@ -0,0 +1 @@
|
||||||
|
postmaster:password
|
20
nodemailer/index.mjs
Normal file
20
nodemailer/index.mjs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
const transporter = nodemailer.createTransport({
|
||||||
|
host: "localhost",
|
||||||
|
port: 1025,
|
||||||
|
secure: false,
|
||||||
|
auth: {
|
||||||
|
user: "postmaster",
|
||||||
|
pass: "password",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const info = await transporter.sendMail({
|
||||||
|
from: "foo <foo@example.com>",
|
||||||
|
to: "bar <bar@example.com>",
|
||||||
|
subject: "Hello world!",
|
||||||
|
html: "<marquee>Hello world.</marquee>",
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(info.messageId);
|
15
nodemailer/package.json
Normal file
15
nodemailer/package.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "nodemailer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Kohei Watanabe <kou029w@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemailer": "^6.9.4"
|
||||||
|
}
|
||||||
|
}
|
13
nodemailer/pnpm-lock.yaml
generated
Normal file
13
nodemailer/pnpm-lock.yaml
generated
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
|
devDependencies:
|
||||||
|
nodemailer:
|
||||||
|
specifier: ^6.9.4
|
||||||
|
version: 6.9.4
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
/nodemailer@6.9.4:
|
||||||
|
resolution: {integrity: sha512-CXjQvrQZV4+6X5wP6ZIgdehJamI63MFoYFGGPtHudWym9qaEHDNdPzaj5bfMCvxG1vhAileSWW90q7nL0N36mA==}
|
||||||
|
engines: {node: '>=6.0.0'}
|
||||||
|
dev: true
|
Loading…
Add table
Reference in a new issue