Utility packages used in the development of ByteMinds PH web platform.
Use with npm:
npx jsr add @jhenbert/byteminds-utilUse with deno:
deno add @jhenbert/byteminds-utilUse with pnpm:
pnpm dlx jsr add @jhenbert/byteminds-utilUse with yarn:
yarn dlx jsr add @jhenbert/byteminds-utilimport * as mod from "@jhenbert/byteminds-util";const sendEmail = async () => {
const from = "[email protected]";
const to = "[email protected]";
const subject = "Hello!";
const body = "<p>This is a test email.</p>";
const message = mod.composeMessage(from, to, subject, body);
const host = "smtp.example.com";
const port = 587;
const secure = false;
const service = "gmail";
const email = "[email protected]";
const password = "user_app_password";
const transporter = mod.mailTransporter(
host,
port,
secure,
service,
email,
password
);
try {
await transporter.sendMail(message);
} catch (error) {
console.error("Sending email failed", (error as Error).message);
}
};