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

0.0.2 • Public • Published

Heriku

sending mail

only works on gmail

import {Email} from "heriku"



const emailConfig = {
  service: 'Gmail', 
  auth: {
    user: 'your-email@gmail.com', 
    pass: 'app password' 
  }
};

const emailSender = new Email(emailConfig);

const emailData = {
  from: 'your-email@gmail.com', // Replace with your email address
  to: 'recipient@example.com', // Replace with the recipient's email address
  subject: 'Test Email',
  text: 'hello.',
  html: '<p><h1>hello world</h1>.</p>'
};


emailSender.sendEmail(emailData)
  .then(() => {
    console.log('Email sent successfully.');
  })
  .catch((error) => {
    console.error('Error sending email:', error);
  });

ChatGpt reply email

import {GPTMail} from "heriku"

// Your OpenAI API key
const apiKey = 'api-key';


const gptMail = new GptMail(apiKey);


const gptConfig = 'Your are a helpfull assistant';//how you want chatgpt to behave
gptMail.setGptType(gptConfig);

const emailConfig = {
  service: 'Gmail', 
  auth: {
    user: 'your-email@gmail.com', 
    pass: 'app password', 
  },
};


gptMail.gptSendReply(emailConfig)
  .then(() => {
    console.log('Emails processed and replied using GPT successfully.');
  })
  .catch((error) => {
    console.error('Error processing and replying to emails:', error);
  });


Package Sidebar

Install

npm i heriku

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

27.8 kB

Total Files

14

Last publish

Collaborators

  • algobreigh