turiy-email
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

Turiy Email Package

This package is built on nodemailer and mjml. The functions exported here is treated as server side functions. This package is able to create connection with your email host and send-email on behalf programatically.

Recommended to use inside server components or use server files.

Sending email with sendMail function

await sendMail(
//Sender email secrets
{
  host: "google.com", //Your email host
  port: 465, //Port number
  emailId: "email.xyz@gmail.com", //Your email-id
  password: "P%^&D&fa78q2%^$%$&*()*^&%", //Your email password
  label: "Mr. Company 💖", //Label that will be shown beside your email-id
},
//Receiver email-ids
['a@x.com', 'b@y.in', 'c@z.co.in',...],
//Email subject
"This is a test mail subject",
//Email body; it might also be created with emailTemplate(...)
'This is a test mail body'
);

Creating email template

Example: Double column responsive email template

emailHtml({
  bgColor: "#ffff00",
  widthPx: 600,
  sections: [
    {
      bgColor: "#ffffff",
      columns: [
        {
          widthPercent: 50,
          child: [
            <div style={{ color: "#000000", fontSize: "20px" }}>
              Hello World
            </div>,
          ],
        },
        {
          widthPercent: 50,
          child: [
            <div style={{ color: "#000000", fontSize: "20px" }}>
              Hello World
            </div>,
          ],
        },
      ],
    },
  ],
});

Package Sidebar

Install

npm i turiy-email

Weekly Downloads

0

Version

1.3.1

License

ISC

Unpacked Size

18.2 kB

Total Files

8

Last publish

Collaborators

  • putonics