npm&github集成:簡化的電子郵件與node.js
>密鑰功能:
>先決條件:
入門:
1。安裝:
使用npm:
npm install job-email-sender
yarn add job-email-sender
2。配置:
>將以下配置添加到您的主要應用程序文件:
const emailConfig = { service: 'your-email-service', // e.g., 'gmail', 'yahoo' user: 'your-email@example.com', // Your email address pass: 'your-email-app-password', // Your email app password (not your regular password!) name: 'Your Display Name' };
重要說明:
your-email@example.com
Your Display Name
字段應與您的電子郵件提供商(Gmail,Yahoo等)匹配。 service
pass
yahoo:
> javaScript:
> typescript:
>const { EmailSender } = require('job-email-sender');
發送電子郵件:
import { EmailSender } from 'job-email-sender';
重要的考慮因素:
const emailSender = new EmailSender(emailConfig); const contacts = [{ email: 'receiver-name@example.com', name: 'Don' }]; const message = 'Hello ${name}, this is your email content!'; // HTML support: 'Hello ${name}, <p><b>this</b> is a test email!</p>' const subject = 'Your Email Subject'; emailSender.sendEmails(contacts, message, subject) .then((message) => console.log(message)) .catch((error) => console.error(error));
附件:>支持電子郵件附件的支持。
以上是電子郵件發送服務的詳細內容。更多資訊請關注PHP中文網其他相關文章!