Utility packages used in the development of ByteMinds PH web platform.
Use with npm:
npx jsr add @jhenbert/byteminds-util
Use with deno:
deno add @jhenbert/byteminds-util
Use with pnpm:
pnpm dlx jsr add @jhenbert/byteminds-util
Use with yarn:
yarn dlx jsr add @jhenbert/byteminds-util
import * as mod from "@jhenbert/byteminds-util";
const sendEmail = async () => {
const from = "sender@example.com";
const to = "recipient@example.com";
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 = "user@example.com";
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);
}
};