// Child of email-check.mjs: one send through the real sender with whatever env it was given.
import { sendEmail, verifyEmailTransport } from '../src/lib/email';

const to = process.argv[2] || 'student@check.test';
(async () => {
  const verify = await verifyEmailTransport();
  const r = await sendEmail(
    to,
    'HostelCare SMTP check',
    'This is the plain text body of a HostelCare email delivery check.',
    '<p>This is the <strong>html body</strong> of a HostelCare email delivery check.</p>',
    [{ filename: 'receipt.pdf', content: Buffer.from('%PDF-1.4\n% HostelCare check\n%%EOF\n') }],
  );
  console.log(JSON.stringify({ verify, ...r }));
  process.exit(0);
})();
