-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirmation_mail_script.html
50 lines (44 loc) · 1.49 KB
/
confirmation_mail_script.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script>
$(function() {setDefaultValues();});
function setDefaultValues() {
google.script.run
.withFailureHandler(function(err){
console.error("error occured", e);
})
.withSuccessHandler(function(res){
$( "#recipient" ).val(res);
})
.getBottomMemberEmail();
google.script.run
.withFailureHandler(function(err){
console.error("error occured", e);
})
.withSuccessHandler(function(res){
$( "#subject" ).val(res);
})
.getWelcomeMessageSubject();
google.script.run
.withFailureHandler(function(err){
console.error("error occured", e);
})
.withSuccessHandler(function(res){
$( "#message" ).val(res);
})
.getWelcomeMessage();
}
function sendRegistrationConfirmationMail(){
var recipient = document.getElementById("recipient");
var subject = document.getElementById('subject');
var body = document.getElementById('message');
if (subject.value == "") {
setError(subject, "Detta fält får ej vara tomt!");
} else if (body.value == "") {
setError(body, "Detta fält får ej vara tomt!");
} else if (recipient.value == "") {
setError(recipient, "Detta fält får ej vara tomt!");
} else {
var dataNlToBr = body.value.replace(/\r?\n/g, '<br>');
google.script.run.sendRegistrationConfirmationMail(recipient.value, subject.value, dataNlToBr, attachments);
}
}
</script>