如何加密从谷歌表单提交的电子邮件?

时间:2014-10-30 14:15:37

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

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

这是当前的脚本: -

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);
}

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

它给出了有趣的结果。

enter image description here

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

(因为您将收到电子邮件,您将获得密钥...我想在任何发送代码的电子邮件中都很容易实现。阅读已解码的邮件会更加棘手,我想最简单方法是创建一个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;
}