プレイグラウンド、サンドボックス、使い捨てスクリプト置き場
0

Configure Feed

Select the types of activity you want to include in your feed.

create nodemailer

Kohei Watanabe (Aug 23, 2023, 10:31 AM +0900) 8d6c754b e3843f84

+74
+6
nodemailer/README.md
··· 1 + ``` 2 + docker compose up -d 3 + # http://localhost:8025 にアクセスして確認 4 + pnpm i 5 + node index.mjs 6 + ```
+19
nodemailer/compose.yml
··· 1 + services: 2 + # maildev: 3 + # image: maildev/maildev 4 + # ports: 5 + # - "1080:1080" # Web UI 6 + # - "1025:1025" 7 + # environment: 8 + # MAILDEV_INCOMING_USER: postmaster 9 + # MAILDEV_INCOMING_PASS: password 10 + mailpit: 11 + image: axllent/mailpit 12 + ports: 13 + - "8025:8025" # Web UI 14 + - "1025:1025" 15 + environment: 16 + MP_SMTP_AUTH_FILE: /etc/mailpit/auth 17 + MP_SMTP_AUTH_ALLOW_INSECURE: "true" 18 + volumes: 19 + - ./etc/mailpit:/etc/mailpit:ro
+1
nodemailer/etc/mailpit/auth
··· 1 + postmaster:password
+20
nodemailer/index.mjs
··· 1 + import nodemailer from "nodemailer"; 2 + 3 + const transporter = nodemailer.createTransport({ 4 + host: "localhost", 5 + port: 1025, 6 + secure: false, 7 + auth: { 8 + user: "postmaster", 9 + pass: "password", 10 + }, 11 + }); 12 + 13 + const info = await transporter.sendMail({ 14 + from: "foo <foo@example.com>", 15 + to: "bar <bar@example.com>", 16 + subject: "Hello world!", 17 + html: "<marquee>Hello world.</marquee>", 18 + }); 19 + 20 + console.log(info.messageId);
+15
nodemailer/package.json
··· 1 + { 2 + "name": "nodemailer", 3 + "version": "1.0.0", 4 + "description": "", 5 + "main": "index.js", 6 + "scripts": { 7 + "test": "echo \"Error: no test specified\" && exit 1" 8 + }, 9 + "keywords": [], 10 + "author": "Kohei Watanabe <kou029w@gmail.com>", 11 + "license": "MIT", 12 + "devDependencies": { 13 + "nodemailer": "^6.9.4" 14 + } 15 + }
+13
nodemailer/pnpm-lock.yaml
··· 1 + lockfileVersion: '6.0' 2 + 3 + devDependencies: 4 + nodemailer: 5 + specifier: ^6.9.4 6 + version: 6.9.4 7 + 8 + packages: 9 + 10 + /nodemailer@6.9.4: 11 + resolution: {integrity: sha512-CXjQvrQZV4+6X5wP6ZIgdehJamI63MFoYFGGPtHudWym9qaEHDNdPzaj5bfMCvxG1vhAileSWW90q7nL0N36mA==} 12 + engines: {node: '>=6.0.0'} 13 + dev: true