2

因此,我有一個Google表單,它將回復發送給電子表格,然後我有一個腳本自動將回覆電子郵件發送給我,但我想要執行的操作是加密發送的電子郵件,這可能嗎?如何加密從Google表單提交發送的電子郵件?

這是當前腳本: -

function sendFormByEmail(e) 
{ 

    var email = "[email protected]" ; 

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

可能要格式化您的代碼,使其更有一點可讀性 – 2014-10-30 14:26:38

+0

有幫助嗎? – user2374110 2014-10-30 14:38:26

回答

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

有使用Google Apps腳本發送加密電子郵件沒有內置的方式。另一種方法是將信息信息放在單獨的文檔/表格中,並通過電子郵件發送鏈接 - 這樣,只有具有查看文檔/表格權限的用戶才能訪問信息。

相關問題