Google Apps Script to automatically send email

I am trying to create a Google Apps Script that will send an email to our client’s general inbox when we receive an email from one of their representatives containing an order. We are required by our contract to provide a receipt of order to a different team on the client side than the team that does the ordering.

I want the script to run every five minutes, and to take all of the new emails that have come in from a specific domain (let’s call it @client.com) and forward those emails to a general inbox (let’s call it geninbox@client.com).

I have the following script compiled, but as I am very, very new to this and have barely a cursory understanding, I have no idea why it does not work. Any help would be greatly appreciated.

function CLIENTreceipt() {     var interval = 5;     var date = new Date();    var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;    var threads = GmailApp.search(' from: @client.com is:inbox after:' + timeFrom);    var msg = "";    var subject = "";    var attachment = "";    for (var i = 0; i < threads.length; i++) {       t = threads[i];       c = t.getMessageCount() - 1;       msg = t.getMessages()[c];       subject = msg.getSubject();       attachment = msg.getAttachments();       msg.forward("geninbox@client.com", {         subject: "The Following order has Been Received: [" + subject + "]",         htmlBody: "Thank you!<br><br>"         +         "This message is confirm receipt of your order. Your order has been forwarded to our service team.<br><br>",         attachments: attachment     });     t.markRead();   } } 

Email Template for Mail merge not working!

function getRowsData(sheet, range, columnHeadersRowIndex) {   columnHeadersRowIndex = columnHeadersRowIndex || range.getRowIndex() - 1;   var numColumns = range.getEndColumn() - range.getColumn() + 1;   var headersRange = sheet.getRange(columnHeadersRowIndex, range.getColumn(), 1, numColumns);   var headers = headersRange.getValues()[0];   return getObjects(range.getValues(), normalizeHeaders(headers)); }   function getObjects(data, keys) {   var objects = [];   for (var i = 0; i < data.length; ++i) {     var object = {};     var hasData = false;     for (var j = 0; j < data[i].length; ++j) {       var cellData = data[i][j];       if (isCellEmpty(cellData)) {         continue;       }       object[keys[j]] = cellData;       hasData = true;     }     if (hasData) {       objects.push(object);     }   }   return objects; }   function normalizeHeaders(headers) {   var keys = [];   for (var i = 0; i < headers.length; ++i) {     var key = normalizeHeader(headers[i]);     if (key.length > 0) {       keys.push(key);     }   }   return keys; }  function normalizeHeader(header) {   var key = '';   var upperCase = false;   for (var i = 0; i < header.length; ++i) {     var letter = header[i];     if (letter == ' ' && key.length > 0) {       upperCase = true;       continue;     }     if (!isAlnum(letter)) {       continue;     }     if (key.length == 0 && isDigit(letter)) {       continue; // first character must be a letter     }     if (upperCase) {       upperCase = false;       key += letter.toUpperCase();     } else {       key += letter.toLowerCase();     }   }   return key; }   function isCellEmpty(cellData) {   return typeof(cellData) == 'string' && cellData == ''; }   function isAlnum(char) {   return char >= 'A' && char <= 'Z' ||     char >= 'a' && char <= 'z' ||     isDigit(char); }   function isDigit(char) {   return char >= '0' && char <= '9'; }   function sendEmails() {   var ss = SpreadsheetApp.getActiveSpreadsheet();   var dataSheet = ss.getSheets()[0];   var dataRange = dataSheet.getRange(2, 1, dataSheet.getMaxRows() - 1, 4);    var templateSheet = ss.getSheets()[1];   var emailTemplate = templateSheet.getRange("A1").getValue();   var emailTemplate2 = templateSheet.getRange("A2").getValue();     var objects = getRowsData(dataSheet, dataRange);    // For every row object, create a personalized email from a template and send   // it to the appropriate person.   for (var i = 0; i < objects.length; ++i) {     // Get a row object     var rowData = objects[i];     var file = DriveApp.getFilesByName('2019_MA_BenefitsGuide.pdf')     var file1 = DriveApp.getFilesByName('List of Acceptable Documents.pdf')      var emailText = fillInTemplateFromObject(emailTemplate, rowData);     var emailText2 = fillInTemplateFromObject(emailTemplate2, rowData);     var emailSubject = 'Mail Merge Test';      MailApp.sendEmail(rowData.emailAddress, emailSubject, emailText,emailText2, {attachments: [file.next(), file1.next()]} );     } }  function fillInTemplateFromObject(template, data) {   var email = template;   // Search for all the variables to be replaced, for instance $  {"Column name"}   var templateVars = template.match(/$  \{\"[^\"]+\"\}/g);    // Replace variables from the template with the actual values from the data object.    for (var i = 0; i < templateVars.length; ++i) {      var variableData = data[normalizeHeader(templateVars[i])];     email = email.replace(templateVars[i], variableData || '');   }    return email; } 

In the function sendEmails() , why doesn’t
MailApp.sendEmail(rowData.emailAddress, emailSubject, (emailText,emailText2), {attachments: [file.next(), file1.next()]} ) –> take text from cells A1 & A2?

SP 2010 – User Email Alerts without SP Access

Hoping for some insight, is it possible to set up users to get email alerts from a list and somehow stop them from being able to actually see anything on the actual SharePoint site?

I tried the route of not giving the users site permission and setting them up with email alerts, but they don’t get anything after the initial “set up” email, so my current theory is they need some sort of permission to actual receive the emails, based on re-doing the alert, asking them to check their spam/junk folders. (however if that is wrong, feel free to correct me).

Essentially, without getting into too much detail, I’m setting up an attendance log, and the goal is to have specific users from specific teams get an email alert when someone on their team calls out and is put down on the list, but we don’t want them to have full access to the list of people who have called out for the day

Unfortunately, I’m not at all involved with our Company IT, so I’m sort of out of my element here, but I figure if I at least know this is possible, and how, I can kindly communicate that to our SP IT group for their assistance/rescue, hah.

Using microsoft flow – sending email with attachment when specific field is modified in sharepoint

I have a sharepoint list which is for safety inductions. Currently when someone submits their safety induction they can choose Yes/No to which aspects of training have been covered and then once submitted it will go to approval based on the Trainer E-mail they have put in the Person field.

With the Yes/No parts I want to set up a Flow which will send an email with an attachment with a competency assessment with a Q and A which covers aspect of that training. For example if they have chosen Yes to Electrical Safety then they will be sent an email with the competency assessment attachment for Electrical Safety from the document library on the same page.

Is this currently possible with Microsoft Flow and Sharepoint Online? I can set it for an entire item but not for a single field.

Thanks

@pnp/sp – send email function returns 404

Just wondering if I could get some help. I built a small webpart that sends an email. On my local workbench it works fine however when I deploy to production

Error: Error making HttpClient request in queryable [404] Not Found ::>

My Import

import { sp,  EmailProperties } from "@pnp/sp"; 

My OnInit establishes context

 public onInit(): Promise<void> {     return super.onInit().then(_ => {       // establish SPFx context       sp.setup({         spfxContext: this.context       });      });   } 

Send email

  const emailProps: EmailProperties = {           To: ["test@myorganisation.com"],           Subject: "This email is about...",           Body: "Here is the body. <b>It supports html</b>"         };          sp.utility.sendEmail(emailProps).then(_ => {           console.log("Email Sent!");         }); 

How to restore GBWhatsApp chats & media from Google drive, when you’ve forgotten the email address you used to back up

My GBWHATSAPP became obsolete & I couldn’t access it anymore to be able to do a proper backup and it was equally challenging to update it directly from the app. After several trials, I uninstalled it and installed a different version I downloaded from a site on the internet. Now, the challenge is to restore my data. When tab on RESTORE they b tell me “No backup in my SD card”. I checked in my Google drive, but couldn’t find the backup. I’ve attached a picture to show the backup that is shown there. It’s an old (as of Oct 2018) & the phone backup. How do I restore my data, please? I really don’t want to lose it.enter image description here

Have I Been Pwned Breached Email List by Domain Names

HIBP is a great service that I’ve been using for a long time.

I had a question surrounding Domain Search feature on HIBP. I believe there has to be some form of verification from our end in order to search for breached accounts by domain. How are the Threat Intelligence companies bypassing this? when all we provide to them are various domains as keywords and they are able to provide us with all the breached emails. Is there a way for us to download the entire email dump for a particular breach? It would be great if you could provide some clarity here!