feat(notification): add to field for email (#327)

This commit is contained in:
Brian Baraban
2020-09-26 14:52:57 -05:00
committed by GitHub
parent 07bd246e87
commit 8828dd15cd
4 changed files with 4 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@ BROWSER_TRUSTED=""
DISCORD_NOTIFY_GROUP="" DISCORD_NOTIFY_GROUP=""
DISCORD_WEB_HOOK="" DISCORD_WEB_HOOK=""
EMAIL_USERNAME="" EMAIL_USERNAME=""
EMAIL_TO=""
EMAIL_PASSWORD="" EMAIL_PASSWORD=""
HEADLESS="" HEADLESS=""
IN_STOCK_WAIT_TIME="" IN_STOCK_WAIT_TIME=""
+1
View File
@@ -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_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 | | `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_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 | | `EMAIL_PASSWORD` | Gmail password | See below if you have MFA |
| `HEADLESS` | Puppeteer to run headless or not | Debugging related, default: `true` | | `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` | | `IN_STOCK_WAIT_TIME` | Time to wait between requests to the same link if it has that card in stock | In seconds, default: `0` |
+1
View File
@@ -67,6 +67,7 @@ const notifications = {
}, },
email: { email: {
password: envOrString(process.env.EMAIL_PASSWORD), password: envOrString(process.env.EMAIL_PASSWORD),
to: envOrString(process.env.EMAIL_TO, envOrString(process.env.EMAIL_USERNAME)),
username: envOrString(process.env.EMAIL_USERNAME) username: envOrString(process.env.EMAIL_USERNAME)
}, },
phone: { phone: {
+1 -1
View File
@@ -25,7 +25,7 @@ export function sendEmail(link: Link, store: Store) {
from: email.username, from: email.username,
subject: Print.inStock(link, store), subject: Print.inStock(link, store),
text: link.cartUrl ? link.cartUrl : link.url, text: link.cartUrl ? link.cartUrl : link.url,
to: email.username to: email.to
}; };
transporter.sendMail(mailOptions, error => { transporter.sendMail(mailOptions, error => {