回答編集履歴
1
a
test
CHANGED
@@ -1,3 +1,83 @@
|
|
1
|
+
1. --
|
2
|
+
|
1
3
|
2. されない
|
2
4
|
|
3
5
|
3. 自分でメールキューを実装することで可能
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
```javascript
|
10
|
+
|
11
|
+
function enqueue() {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
const pre
|
16
|
+
|
17
|
+
= "この度は申し込み頂きありがとうございます。 \n"
|
18
|
+
|
19
|
+
+ "今回のお申し込み内容は下記となります。 \n\n"
|
20
|
+
|
21
|
+
+ "======================================= \n\n"
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
const post
|
26
|
+
|
27
|
+
= "======================================= \n\n"
|
28
|
+
|
29
|
+
+ "※このメールは送信専用メールアドレスから配信されています。 \n"
|
30
|
+
|
31
|
+
+ "※このままご返信いただいてもお答えできませんのでご了承ください。 \n"
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
//後の処理で使うため、変数を設定。(フォームと名称を一致させる必要あり)
|
36
|
+
|
37
|
+
const mail = 'メールアドレス';
|
38
|
+
|
39
|
+
const name = 'お名前';
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
const sheet = SpreadsheetApp.getActiveSheet();
|
44
|
+
|
45
|
+
const range = sheet.getDataRange().getValues();
|
46
|
+
|
47
|
+
const TIMESTAMP_LABEL = 'タイムスタンプ';
|
48
|
+
|
49
|
+
const header = range.slice(0,1).map(function(e){ return e === TIMESTAMP_LABEL ? "申し込み日時" : e; });
|
50
|
+
|
51
|
+
const tail = range.slice([1]);
|
52
|
+
|
53
|
+
const num = range.length;
|
54
|
+
|
55
|
+
const body = tail[header.indexOf(name)] + " 様\n\n" + pre + header.map(function(e, i) { return "■"+e+"\n" + (e === "受付番号" ? num : (e === "申し込み日時" ? Utilities.formatDate(tail[i], 'Asia/Tokyo', "YYYY'年'MM'月'dd'日'HH'時'mm'分'ss'秒'" : tail[i])); }).join("\n\n") + "\n\n" + post;
|
56
|
+
|
57
|
+
sheet.getRange(num, 1).setValue(num);
|
58
|
+
|
59
|
+
const subject = "【受付番号: "+num+"】事前申し込みを受け付けました";
|
60
|
+
|
61
|
+
const to = tail[header.indexOf(mail)];
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("queue").appendRow([to, subject, body]);
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
function dequeue() {
|
70
|
+
|
71
|
+
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("queue");
|
72
|
+
|
73
|
+
sheet.getDataRange().getValues().slice(0, 100).forEach(function(e) {
|
74
|
+
|
75
|
+
GmailApp.sendEmail(e[0], e[1], e[2]);
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
sheet.deleteRows(1, 100);
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
```
|