Skip to content

Latest commit

 

History

History
35 lines (35 loc) · 2.43 KB

README.md

File metadata and controls

35 lines (35 loc) · 2.43 KB

English | 简体中文

leetcode-daily-mailer

A simple node program that automatically sends you the leetcode daily question every day, using leetcode-daily-question to get the daily question, and nodemailer to send emails, the result is as follows img.png

Quick start

  1. The current service is deployed on vercel (no payment required) You can deploy your own service directly by clicking on the button Deploy with Vercel
  2. Set the required environment variables
    env_name desc example require default
    EMAIL_LANGUAGE Language of email content(en or cn) en false cn
    FROM_EMAIL email to send daily questions [email protected] true
    TO_EMAIL The email address to receive the daily question (multiple, separated by commas) [email protected],[email protected] true
    SMTP_EMAIL_HOST SMTP domain name of the sender's mailbox smtp.gmail.com true
    SMTP_PORT SMTP port of the sender's mailbox 465 false 465
    AUTH_USER The account number of the sender's mailbox [email protected] true
    AUTH_PASS Password of the sender's mailbox password true
  3. in the . /vercel.json file to set the sending time, note that vercel uses the UTC time zone, the following indicates that it will be sent at 1:00 a.m. every day in the UTC time zone, corresponding to 9:00 a.m. in the UTC+8 time zone
{
   "crons": [
      {
         "path": "/api/send",
         "schedule": "0 1 * * *"
      }
   ]
}
  1. After deployment, you can directly access the /api/send path to test whether the send is successful

How to debug

  1. clone project
  2. Set the environment variables locally, create an .env' file in the project root directory, and set the necessary environment variables in the .env' file
  3. Install vercel cli tool according to https://vercel.com/docs/cli
  4. Start the project with 'vercel dev
  5. Visit https://localhost:3000/api/send