Email using bcc now, added jessica

This commit is contained in:
Martin Donnelly 2019-09-15 14:51:50 +01:00
parent 908ac6b3a8
commit 7ca21f8e5a

128
index.js
View File

@ -33,18 +33,30 @@ const mailer = new UltraSES({
});
const menu = [
{ 'name': 'Asian pepper steak crock pot recipe', 'url': 'https://www.marksdailyapple.com/asian-pepper-steak-crock-pot-recipe/#axzz29jTSubMo' },
{
'name': 'Asian pepper steak crock pot recipe',
'url': 'https://www.marksdailyapple.com/asian-pepper-steak-crock-pot-recipe/#axzz29jTSubMo'
},
{ 'name': 'Beef burgandy', 'url': 'http://www.marksdailyapple.com/beef-burgundy-recipe/#axzz29jTSubMo' },
{ 'name': 'italian sausage meatballs', 'url': 'http://www.marksdailyapple.com/primal-meatballs/#axzz29jTSubMo' },
{ 'name': 'frittata aleta', 'url': 'http://www.marksdailyapple.com/frittata-aleta/#axzz29jTSubMo' },
{ 'name': 'garlic pulled pork', 'url': 'http://www.marksdailyapple.com/garlic-pulled-pork/#axzz29jTSubMo' },
{ 'name': 'crock pot pork stuffed peppers', 'url': 'http://www.marksdailyapple.com/crock-pot-pork-stuffed-peppers/#axzz29jTSubMo' },
{ 'name': 'sesame chicken with "rice"', 'url': 'http://www.marksdailyapple.com/sesame-chicken-and-rice-with-fiery-ginger-and-chile-sauce/#axzz29jTSubMo' },
{ 'name': 'crispy nut and herb fried chicken', 'url': 'http://www.marksdailyapple.com/crispy-nut-and-herb-fried-chicken-with-creamy-avocado/#axzz29jTSubMo' },
{
'name': 'sesame chicken with "rice"',
'url': 'http://www.marksdailyapple.com/sesame-chicken-and-rice-with-fiery-ginger-and-chile-sauce/#axzz29jTSubMo'
},
{
'name': 'crispy nut and herb fried chicken',
'url': 'http://www.marksdailyapple.com/crispy-nut-and-herb-fried-chicken-with-creamy-avocado/#axzz29jTSubMo'
},
{ 'name': 'spicy chicken and bacon poppers', 'url': 'http://www.marksdailyapple.com/spicy-chicken-and-bacon-poppers/#axzz29jTSubMo' },
{ 'name': 'butter chicken in silky sauce', 'url': 'http://www.marksdailyapple.com/butter-chicken-in-a-silky-sauce/#axzz29jTSubMo' },
{ 'name': 'steak', 'url': 'https://www.farmison.com/community/recipe/how-to-cook-your-beef-fillet-steak' },
{ 'name': 'hazelnut crusted chicken', 'url': 'http://www.marksdailyapple.com/hazelnut-crusted-chicken-with-stealth-coconut/#axzz29jTSubMo' },
{
'name': 'hazelnut crusted chicken',
'url': 'http://www.marksdailyapple.com/hazelnut-crusted-chicken-with-stealth-coconut/#axzz29jTSubMo'
},
{ 'name': 'vegetable latkes', 'url': 'http://www.marksdailyapple.com/vegetable-latkes/#axzz29jTSubMo' },
{ 'name': 'beef stew', 'url': 'http://www.marksdailyapple.com/beef-stew-and-chicken-soup-in-35-minutes-or-less/#axzz29jTSubMo' },
{ 'name': 'chicken soup', 'url': 'http://www.marksdailyapple.com/beef-stew-and-chicken-soup-in-35-minutes-or-less/#axzz29jTSubMo' },
@ -64,24 +76,51 @@ const menu = [
{ 'name': 'balsamic glazed drumsticks', 'url': 'http://www.marksdailyapple.com/balsamic-glazed-drumsticks/#axzz29jTSubMo' },
{ 'name': 'herb chicken cooked under a brick', 'url': 'http://www.marksdailyapple.com/herb-chicken-cooked-under-a-brick/#axzz29jTSubMo' },
{ 'name': 'pork stuffed jalapeno peppers', 'url': 'http://www.marksdailyapple.com/pork-stuffed-jalapeno-peppers/#axzz29jTSubMo' },
{ 'name': 'spiced pork butternut squash', 'url': 'http://www.marksdailyapple.com/spiced-pork-and-butternut-squash-with-sage/#axzz29jTSubMo' },
{
'name': 'spiced pork butternut squash',
'url': 'http://www.marksdailyapple.com/spiced-pork-and-butternut-squash-with-sage/#axzz29jTSubMo'
},
{ 'name': 'shakshuka', 'url': 'http://www.marksdailyapple.com/shakshuka-eggs-poached-in-spicy-tomato-sauce/#axzz29jTSubMo' },
{ 'name': 'grilled lime chicken', 'url': 'http://www.simplyrecipes.com/recipes/grilled_lime_chicken_with_black_bean_sauce/' },
{ 'name': 'eggs benadict burger', 'url': 'https://paleoleap.com/eggs-benedict-burgers/' },
{ 'name': 'asian marinated steaks', 'url': 'https://web.archive.org/web/20120330045230/http://www.paleotable.com/2011/01/asian-marinated-steaks.html' },
{
'name': 'asian marinated steaks',
'url': 'https://web.archive.org/web/20120330045230/http://www.paleotable.com/2011/01/asian-marinated-steaks.html'
},
{ 'name': 'tango burgers', 'url': 'https://web.archive.org/web/20120127101048/http://www.paleotable.com/2011/01/tango-burgers.html' },
{ 'name': 'meatza', 'url': 'https://web.archive.org/web/20120118062740/http://www.paleotable.com/2011/02/meatza.html' },
{ 'name': 'baked chicken with roasted tomatos', 'url': 'https://web.archive.org/web/20120125102938/http://www.paleotable.com/2011/01/baked-chicken-with-roasted-tomatoes.html' },
{ 'name': 'blackened chicken', 'url': 'https://web.archive.org/web/20120420232533/http://www.paleotable.com/2011/02/blackened-chicken.html' },
{
'name': 'baked chicken with roasted tomatos',
'url': 'https://web.archive.org/web/20120125102938/http://www.paleotable.com/2011/01/baked-chicken-with-roasted-tomatoes.html'
},
{
'name': 'blackened chicken',
'url': 'https://web.archive.org/web/20120420232533/http://www.paleotable.com/2011/02/blackened-chicken.html'
},
{ 'name': 'breaded baked chicken', 'url': 'https://www.tastesoflizzyt.com/paleo-baked-chicken/' },
{ 'name': 'chicken and avocado tostadas', 'url': 'https://web.archive.org/web/20120707073826/http://www.paleotable.com/2011/03/chicken-and-avocado-tostadas.html' },
{ 'name': 'sausages and pepperonata', 'url': 'https://web.archive.org/web/20120707071653/http://www.paleotable.com/2011/01/sausages-and-pepperonata.html' },
{
'name': 'chicken and avocado tostadas',
'url': 'https://web.archive.org/web/20120707073826/http://www.paleotable.com/2011/03/chicken-and-avocado-tostadas.html'
},
{
'name': 'sausages and pepperonata',
'url': 'https://web.archive.org/web/20120707071653/http://www.paleotable.com/2011/01/sausages-and-pepperonata.html'
},
{ 'name': 'Mediterranean Beef Stew with Green Olive Pesto', 'url': 'http://www.health-bent.com/soups/paleo-mediterranean-beef-stew' },
{ 'name': 'Beanless Chili', 'url': 'https://web.archive.org/web/20121004005636/http://www.realfoodfreaks.com/2012/04/02/chili-beanless-cuz-i-dont-eat-em/' },
{ 'name': 'Grilled Steak with Roasted Jalapeño Chimichurri', 'url': 'https://www.seriouseats.com/recipes/2012/05/ted-allens-grilled-steak-with-roasted-jalepeno.html' },
{
'name': 'Beanless Chili',
'url': 'https://web.archive.org/web/20121004005636/http://www.realfoodfreaks.com/2012/04/02/chili-beanless-cuz-i-dont-eat-em/'
},
{
'name': 'Grilled Steak with Roasted Jalapeño Chimichurri',
'url': 'https://www.seriouseats.com/recipes/2012/05/ted-allens-grilled-steak-with-roasted-jalepeno.html'
},
{ 'name': 'Lime and Coconut Chicken', 'url': 'http://chaosinthekitchen.com/2009/07/lime-and-coconut-chicken/' },
{ 'name': 'BEEF AND VEGETABLE CHILI', 'url': 'http://www.paleoplan.com/2011/10-12/steak-and-vegetable-chili/' },
{ 'name': 'PORK LOIN WITH PEPPERS, MUSHROOMS AND ONIONS', 'url': 'https://www.paleoplan.com/2010/02-23/pork-loin-with-peppers-mushrooms-n-onions/' },
{
'name': 'PORK LOIN WITH PEPPERS, MUSHROOMS AND ONIONS',
'url': 'https://www.paleoplan.com/2010/02-23/pork-loin-with-peppers-mushrooms-n-onions/'
},
{ 'name': 'Melt In Your Mouth Slow Cooker Beef Brisket', 'url': 'https://paleogrubs.com/beef-brisket-recipe' },
{ 'name': 'Yummy Sweet Potato Gnocchi', 'url': 'https://paleogrubs.com/sweet-potato-gnocchi-recipe' },
{ 'name': 'Simple Beef and Broccoli Stir Fry', 'url': 'https://paleogrubs.com/beef-and-broccoli-recipe' },
@ -89,7 +128,10 @@ const menu = [
{ 'name': 'Quick & Easy Crock Pot Chili', 'url': 'https://www.healthstartsinthekitchen.com/2014/01/04/quick-crock-pot-chili/' },
{ 'name': 'Tom Kha Gai -- Thai Coconut Soup', 'url': 'https://www.angsarap.net/2012/03/08/tom-kha-gai/' },
{ 'name': 'Roasted, Herbed Beef Tenderloin Recipe', 'url': 'https://www.chowhound.com/recipes/roasted-herbed-beef-tenderloin-30901' },
{ 'name': 'Chorizo Carbonara', 'url': 'https://www.jamieoliver.com/recipes/pasta-recipes/chorizo-carbonara-with-catalan-market-salad/#1EmLf9RiqepY4Z95.97' },
{
'name': 'Chorizo Carbonara',
'url': 'https://www.jamieoliver.com/recipes/pasta-recipes/chorizo-carbonara-with-catalan-market-salad/#1EmLf9RiqepY4Z95.97'
},
{ 'name': 'Roasted Tomato Soup with Fresh Basil', 'url': 'https://civilizedcaveman.com/recipes/soups/roasted-tomato-soup/' },
{ 'name': 'swedish meatballs', 'url': 'https://www.paleorunningmomma.com/paleo-swedish-meatballs-whole30/' },
{ 'name': 'Tom Yum Gai - hot and sour soup', 'url': 'http://angsarap.net/2013/08/07/tom-yum-gai/' },
@ -108,29 +150,41 @@ const menu = [
{ 'name': 'Grilled Tandoori Chicken', 'url': 'http://cookingweekends.blogspot.com/2012/05/grilled-tandoori-chicken.html' },
{ 'name': 'Stuffed Chicken Breast (paleo and grain free)', 'url': 'http://www.cavegirlcuisine.com/recipes/stuffed-chicken-breast/' },
{ 'name': 'Lemon Chicken Breast Recipe', 'url': 'https://www.everydaymaven.com/lemon-chicken-breast/' },
{ 'name': 'Grilled Lemon Garlic Rosemary Chicken Breasts', 'url': 'https://www.phoenixhelix.com/2013/07/21/grilled-lemon-garlic-rosemary-chicken-breasts/' },
{ 'name': 'Paleo Spicy Mustard Crockpot Chicken', 'url': 'https://www.plaidandpaleo.com/2013/10/paleo-spicy-mustard-crockpot-chicken.html' },
{
'name': 'Grilled Lemon Garlic Rosemary Chicken Breasts',
'url': 'https://www.phoenixhelix.com/2013/07/21/grilled-lemon-garlic-rosemary-chicken-breasts/'
},
{
'name': 'Paleo Spicy Mustard Crockpot Chicken',
'url': 'https://www.plaidandpaleo.com/2013/10/paleo-spicy-mustard-crockpot-chicken.html'
},
{ 'name': 'Creamy Paleo Chicken Skillet', 'url': 'http://paleogrubs.com/skillet-chicken-recipe' },
{ 'name': 'Sweet and Savory Moroccan Chicken', 'url': 'http://paleogrubs.com/moroccan-chicken-recipe' },
{ 'name': 'Simple and Addictive Chicken Kabobs', 'url': 'http://paleogrubs.com/chicken-kabob-recipe' },
{ 'name': 'Indian Paleo Stew with Chicken', 'url': 'http://paleogrubs.com/indian-paleo-stew-recipe' },
{ 'name': 'Slow-Cooker Swedish Kalops Stew', 'url': 'https://web.archive.org/web/20130501032143/http://www.mylivingnutrition.com/2013/04/11/slow-cooker-swedish-kalops-stew/' },
{
'name': 'Slow-Cooker Swedish Kalops Stew',
'url': 'https://web.archive.org/web/20130501032143/http://www.mylivingnutrition.com/2013/04/11/slow-cooker-swedish-kalops-stew/'
},
{ 'name': 'Beef, Bacon and Rum Stew', 'url': 'http://domesticsoul.com/2011/12/beef-bacon-rum-stew-recipe.html' },
{ 'name': 'Paleo Orange Cinnamon Beef Stew', 'url': 'https://thehealthyfoodie.com/orange-cinnamon-beef-stew/' },
{ 'name': 'pepper steak', 'url': 'http://paleoleap.com/pepper-steak/' },
{ 'name': 'GARLIC ROASTED COD', 'url': 'http://paleoleap.com/garlic-roasted-cod/' },
{ 'name':'Easy Bacon-Wrapped Paleo Meatloaf Muffins', 'url':'https://paleogrubs.com/bacon-wrapped-meatloaf-muffins' },
{ 'name':'Easy Ground Beef Stuffed Peppers', 'url':'https://paleogrubs.com/ground-beef-stuffed-peppers' },
{ 'name':'Cream of Chicken Soup', 'url':'https://paleogrubs.com/crockpot-cream-of-chicken-soup' },
{ 'name':'balsamic grilled chicken with greek style salad', 'url':'https://paleoleap.com/balsamic-grilled-chicken-greek-style-salad/' },
{ 'name':'slow cooked hawaiian style kalua pork', 'url':'https://paleoleap.com/slow-cooked-hawaiian-style-kalua-pork/' },
{ 'name':'Sweet Thai Chili Chicken With Roasted Peppers', 'url':'http://paleoleap.com/sweet-thai-chili-chicken-roasted-peppers/' },
{ 'name':'Steak Ratatouille', 'url':'http://www.jamieoliver.com/recipes/beef-recipes/grilled-steak-ratatouille-saffron-rice/' },
{ 'name':'Slow Cooked Balsamic Pork Roast', 'url':'https://paleoleap.com/slow-cooked-balsamic-pork-roast/' },
{ 'name':'Seared Cod with Fresh Herb Sauce', 'url':'http://paleoleap.com/seared-cod-fresh-herb-sauce/' },
{ 'name':'Honey Ginger Apple Shredded Pork', 'url':'https://paleomg.com/honey-ginger-apple-shredded-pork/' },
{ 'name':'Orange Pineapple Pulled Pork', 'url':'http://www.smokedngrilled.com/orange-pineapple-pulled-pork/' }
{ 'name': 'Easy Bacon-Wrapped Paleo Meatloaf Muffins', 'url': 'https://paleogrubs.com/bacon-wrapped-meatloaf-muffins' },
{ 'name': 'Easy Ground Beef Stuffed Peppers', 'url': 'https://paleogrubs.com/ground-beef-stuffed-peppers' },
{ 'name': 'Cream of Chicken Soup', 'url': 'https://paleogrubs.com/crockpot-cream-of-chicken-soup' },
{ 'name': 'balsamic grilled chicken with greek style salad', 'url': 'https://paleoleap.com/balsamic-grilled-chicken-greek-style-salad/' },
{ 'name': 'slow cooked hawaiian style kalua pork', 'url': 'https://paleoleap.com/slow-cooked-hawaiian-style-kalua-pork/' },
{ 'name': 'Sweet Thai Chili Chicken With Roasted Peppers', 'url': 'http://paleoleap.com/sweet-thai-chili-chicken-roasted-peppers/' },
{ 'name': 'Steak Ratatouille', 'url': 'http://www.jamieoliver.com/recipes/beef-recipes/grilled-steak-ratatouille-saffron-rice/' },
{ 'name': 'Slow Cooked Balsamic Pork Roast', 'url': 'https://paleoleap.com/slow-cooked-balsamic-pork-roast/' },
{ 'name': 'Seared Cod with Fresh Herb Sauce', 'url': 'http://paleoleap.com/seared-cod-fresh-herb-sauce/' },
{ 'name': 'Honey Ginger Apple Shredded Pork', 'url': 'https://paleomg.com/honey-ginger-apple-shredded-pork/' },
{ 'name': 'Orange Pineapple Pulled Pork', 'url': 'http://www.smokedngrilled.com/orange-pineapple-pulled-pork/' },
{ 'name': 'Brazilian Curry Chicken', 'url': 'https://paleomg.com/brazilian-curry-chicken/' },
{ 'name': 'Teriyaki Meatballs', 'url': 'https://paleogrubs.com/teriyaki-meatballs' },
{ 'name': 'Paleo Slow Cooker Bacon BBQ Chicken', 'url': 'https://paleogrubs.com/chicken-breast-recipes' },
{ 'name': 'Honey-Lime Grilled Chicken Skewers', 'url': 'https://paleogrubs.com/honey-lime-grilled-chicken-skewers' }
];
// {'name':'', 'url':''}
@ -138,10 +192,10 @@ const menu = [
function sendEmail(data, newpath) {
const now = new Date();
const email = {
'to': 'martind2000@gmail.com', 'subject': `Suggestions - ${ dateFormat(now, 'dddd, mmmm dS, yyyy')}`
'to': 'martind2000@gmail.com', 'subject': `Suggestions - ${dateFormat(now, 'dddd, mmmm dS, yyyy')}`
};
const template = {
'file': `${newpath }/` + 'pug/email.jade', 'locals': data
'file': `${newpath}/` + 'pug/email.jade', 'locals': data
};
mailer.sendTemplate(email, template, err => {
@ -153,18 +207,18 @@ function sendEmail(data, newpath) {
function sendSMTP(data, newPath) {
const now = new Date();
const html = pug.renderFile( `${newPath }/` + 'pug/email.pug', data);
const html = pug.renderFile(`${newPath}/` + 'pug/email.pug', data);
email({
'from': 'Aida <aida@caliban.io>',
'to': 'Aida <aida@caliban.io>',
'bcc': 'Martin <martind2000@gmail.com>, Jessica <ing.arvid@gmail.com>',
'subject': `Suggestions 🍳 - ${ dateFormat(now, 'dddd, mmmm dS, yyyy')}`,
'subject': `Suggestions 🍳 - ${dateFormat(now, 'dddd, mmmm dS, yyyy')}`,
'html': html
});
}
function pugTest(data, newpath) {
logger.debug(pug.renderFile( `${newpath }/` + 'pug/email.pug', data));
logger.debug(pug.renderFile(`${newpath}/` + 'pug/email.pug', data));
}
function doJob() {
@ -186,7 +240,7 @@ function doJob() {
suggestions.push(menu[randomnumber]);
history.push(randomnumber);
}
} while(usedNumbers.length < 5);
} while (usedNumbers.length < 5);
data.ts = now.toLocaleDateString('en-GB', options);
data.suggestions = suggestions;
@ -198,9 +252,9 @@ function doJob() {
logger.debug(`Done:${data.ts}`);
}
(function() {
// doJob();
(function () {
logger.info('Menuizer started');
doJob();
}());
cron.schedule('0 8 * * 6', function () {