【问题标题】:How to encrypt emails sent from google form submissions?如何加密从谷歌表单提交发送的电子邮件?
【发布时间】:2014-10-30 14:15:37
【问题描述】:

所以我有一个谷歌表单,可以将它的回复发送到电子表格,然后我有一个脚本可以自动将回复通过电子邮件发送给我,但我想要做的是加密正在发送的电子邮件,这可能吗?

这是当前脚本:-

function sendFormByEmail(e)
{

    var email = "myemail@domain.com" ;

    var subject = "New Sample Request Submitted";

    var s = SpreadsheetApp.getActiveSheet();
    var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
    var message = "New Sample Request from Website";

    for(var i in headers)
    message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "\n\n";

    MailApp.sendEmail(email, subject, message);
}

【问题讨论】:

  • 您可能需要格式化您的代码以使其更具可读性

标签: email encryption google-apps-script google-sheets google-forms


【解决方案1】:

互联网上有一些有趣的东西...,我喜欢this one 的简单性(简单的替换密码),所以我借了它并对其进行了一些修改。我还必须编写解码部分,但这很容易;-)

它给出了有趣的结果。

以上是结果...对代码或解码值感兴趣?然后阅读以下内容:

(因为您将收到电子邮件,所以您将拥有密钥......我想在任何电子邮件发送代码中实现它都会相当容易。阅读解码的消息会更加棘手,我想最简单的方法是创建一个 gmail 过滤器来为这些消息分配一个标签,然后从那里编写一个应用程序来使用解码功能读取它们。)

function test(){
  var key = "#@&é,?(§è!çà)-_°$*^¨`£ù%=+MPLOKIJUHYGTFRDESZQANBVCXW";
  Logger.log(encode(key,'My name is bond, James Bond'));
  Logger.log(decode(key,encode(key,'My name is bond James Bond')));
}


function encode(key, message)
// Given  : key is a string of the 52 letters in arbitrary order (2 x 26 characters),
//          message is the string to be encoded using the key
// Returns: the coded version of message using the substitution key 
{
  var alphabet, coded, i, ch, index;

  alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

  coded = "";                                      
  for (i = 0; i < message.length; i++) {      // for as many letters as there are
    ch = message.charAt(i);                   // access the letter in the message
    index = alphabet.indexOf(ch);             // find its position in alphabet
    if (index == -1) {                        // if it's not a letter,
      coded = coded + ch;                     // then leave it as is & add
    }                                         // otherwise,
    else {                                    // find the corresponding
      coded = coded + key.charAt(index);      // letter in the key & add
    }
  }
  return coded;
}

function decode(key, message){
  var alphabet, decoded, i, ch, index; 
  alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
  decoded = "";                                      
  for (i = 0; i < message.length; i++) {         // for as many letters as there are
    ch = message.charAt(i);                      // access the letter in the message
    index = key.indexOf(ch);                     // find its position in key
    if (index == -1) {                           // if it's not in the key,
      decoded = decoded + ch;                    // then leave it as is & add
    }                                            // otherwise,
    else {                                       // find the corresponding
      decoded = decoded + alphabet.charAt(index);// letter in the alphabet & add
    }
  }
  return decoded;
}

【讨论】:

    【解决方案2】:

    没有使用 Apps 脚本发送加密电子邮件的内置方式。另一种方法是将消息信息放在单独的文档/表格中,并通过电子邮件发送一个链接 - 这样只有有权查看文档/表格的人才能访问信息。

    【讨论】:

      猜你喜欢
      • 2021-05-09
      • 1970-01-01
      • 2015-05-06
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      • 1970-01-01
      • 2021-01-07
      相关资源
      最近更新 更多