diff --git a/.env-example b/.env-example index 02a0f8e..51ae3ca 100644 --- a/.env-example +++ b/.env-example @@ -6,6 +6,7 @@ BROWSER_TRUSTED="" DISCORD_NOTIFY_GROUP="" DISCORD_WEB_HOOK="" EMAIL_USERNAME="" +EMAIL_TO="" EMAIL_PASSWORD="" HEADLESS="" IN_STOCK_WAIT_TIME="" diff --git a/README.md b/README.md index cc8740c..5e57643 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Here is a list of variables that you can use to customize your newly copied `.en | `DISCORD_NOTIFY_GROUP` | Discord group you would like to notify | Can be comma separated, use role ID, E.g.: `<@2834729847239842>` | | `DISCORD_WEB_HOOK` | Discord Web Hook URL | Can be comma separated, use whole webhook URL | | `EMAIL_USERNAME` | Gmail address | E.g.: `jensen.robbed.us@gmail.com` | +| `EMAIL_TO` | Destination Email | Defaults to username if not set. Can be comma separated | | `EMAIL_PASSWORD` | Gmail password | See below if you have MFA | | `HEADLESS` | Puppeteer to run headless or not | Debugging related, default: `true` | | `IN_STOCK_WAIT_TIME` | Time to wait between requests to the same link if it has that card in stock | In seconds, default: `0` | diff --git a/src/config.ts b/src/config.ts index 49bd5d7..81a747f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -67,6 +67,7 @@ const notifications = { }, email: { password: envOrString(process.env.EMAIL_PASSWORD), + to: envOrString(process.env.EMAIL_TO, envOrString(process.env.EMAIL_USERNAME)), username: envOrString(process.env.EMAIL_USERNAME) }, phone: { diff --git a/src/notification/email.ts b/src/notification/email.ts index d232c8d..6457249 100644 --- a/src/notification/email.ts +++ b/src/notification/email.ts @@ -25,7 +25,7 @@ export function sendEmail(link: Link, store: Store) { from: email.username, subject: Print.inStock(link, store), text: link.cartUrl ? link.cartUrl : link.url, - to: email.username + to: email.to }; transporter.sendMail(mailOptions, error => {