2015-06-13 19:46:07 +02:00
|
|
|
<script type="text/x-red" data-template-name="e-mail">
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-envelope"></i> <span data-i18n="email.label.to"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-name" placeholder="email@address.com">
|
|
|
|
</div>
|
|
|
|
<!-- <div class="form-row">
|
|
|
|
<label for="node-input-pin"><i class="fa fa-asterisk"></i> Service</label>
|
|
|
|
<select type="text" id="node-input-pin" style="width: 150px;">
|
|
|
|
<option value="-" disabled> </option>
|
|
|
|
<option value="DynectEmail">DynectEmail</option>
|
|
|
|
<option value="Gmail">Gmail</option>
|
|
|
|
<option value="hot.ee">hot.ee</option>
|
|
|
|
<option value="Hotmail">Hotmail</option>
|
|
|
|
<option value="iCloud">iCloud</option>
|
|
|
|
<option value="mail.ee">mail.ee</option>
|
|
|
|
<option value="Mail.Ru">Mail.Ru</option>
|
|
|
|
<option value="Mailgun">Mailgun</option>
|
|
|
|
<option value="Mailjet">Mailjet</option>
|
|
|
|
<option value="Mandrill">Mandrill</option>
|
|
|
|
<option value="Postmark">Postmark</option>
|
|
|
|
<option value="QQ">QQ</option>
|
|
|
|
<option value="QQex">QQex</option>
|
|
|
|
<option value="SendGrid">SendGrid</option>
|
|
|
|
<option value="SendCloud">SendCloud</option>
|
|
|
|
<option value="SES">SES</option>
|
|
|
|
<option value="Yahoo">Yahoo</option>
|
|
|
|
<option value="yandex">yandex</option>
|
|
|
|
<option value="Zoho">Zoho</option>
|
|
|
|
</select>
|
|
|
|
</div> -->
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="email.label.server"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-server" placeholder="smtp.gmail.com">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-port"><i class="fa fa-random"></i> <span data-i18n="email.label.port"></span></label>
|
2017-02-13 23:43:43 +01:00
|
|
|
<input type="text" id="node-input-port" placeholder="465" style="width:100px">
|
|
|
|
<label style="width:40px"> </label>
|
|
|
|
<input type="checkbox" id="node-input-secure" style="display:inline-block; width:20px; vertical-align:baseline;">
|
2017-07-12 19:16:43 +02:00
|
|
|
<span data-i18n="email.label.useSecureConnection"></span>
|
2015-06-13 19:46:07 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-userid"><i class="fa fa-user"></i> <span data-i18n="email.label.userid"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-userid">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-password"><i class="fa fa-lock"></i> <span data-i18n="email.label.password"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="password" id="node-input-password">
|
|
|
|
</div>
|
|
|
|
<br/>
|
2018-08-22 14:57:42 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-useTLS"><i class="fa fa-lock"></i> <span data-i18n="email.label.useTLS"></label>
|
|
|
|
<input type="checkbox" id="node-input-tls" style="display:inline-block; width:20px; vertical-align:baseline;">
|
|
|
|
</div>
|
2015-06-13 19:46:07 +02:00
|
|
|
<div class="form-row">
|
2015-06-16 12:16:29 +02:00
|
|
|
<label for="node-input-dname"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
|
|
|
<input type="text" id="node-input-dname" data-i18n="[placeholder]node-red:common.label.name">
|
2015-06-13 19:46:07 +02:00
|
|
|
</div>
|
2019-02-11 20:26:45 +01:00
|
|
|
|
2015-06-16 11:36:19 +02:00
|
|
|
<div class="form-tips" id="node-tip"><span data-i18n="[html]email.tip.cred"></span></div>
|
2015-06-13 19:46:07 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
|
|
|
RED.nodes.registerType('e-mail',{
|
|
|
|
category: 'social-output',
|
|
|
|
color:"#c7e9c0",
|
|
|
|
defaults: {
|
|
|
|
server: {value:"smtp.gmail.com",required:true},
|
|
|
|
port: {value:"465",required:true},
|
2017-02-13 23:43:43 +01:00
|
|
|
secure: {value: true},
|
2018-08-22 14:57:42 +02:00
|
|
|
tls: {value: true},
|
2015-06-13 19:46:07 +02:00
|
|
|
name: {value:""},
|
|
|
|
dname: {value:""}
|
|
|
|
},
|
|
|
|
credentials: {
|
|
|
|
userid: {type:"text"},
|
|
|
|
password: {type: "password"},
|
|
|
|
global: { type:"boolean"}
|
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "envelope.png",
|
|
|
|
align: "right",
|
2018-04-14 23:43:14 +02:00
|
|
|
paletteLabel: function() {
|
|
|
|
return this._("email.email");
|
|
|
|
},
|
2015-06-13 19:46:07 +02:00
|
|
|
label: function() {
|
|
|
|
return this.dname||this.name||"email";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
2018-03-20 18:18:20 +01:00
|
|
|
return (this.dname)?"node_label_italic":"";
|
2015-06-13 19:46:07 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
if (this.credentials.global) {
|
|
|
|
$('#node-tip').show();
|
|
|
|
} else {
|
|
|
|
$('#node-tip').hide();
|
2015-06-16 15:38:36 +02:00
|
|
|
}
|
2015-06-13 19:46:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="e-mail in">
|
2019-01-31 22:00:31 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-fetch"><i class="fa fa-hourglass-half"></i> <span data-i18n="email.label.getmail"></span></label>
|
|
|
|
<select type="text" id="node-input-fetch" style="width:130px;">
|
|
|
|
<option value="auto" data-i18n="email.label.auto"></option>
|
|
|
|
<option value="trigger" data-i18n="email.label.trigger"></option>
|
|
|
|
</select>
|
|
|
|
<span id="node-repeatTime">
|
|
|
|
<span style="margin-left:20px;" data-i18n="email.label.repeat"></span>
|
|
|
|
<input type="text" id="node-input-repeat" style="width:80px"> <span data-i18n="email.label.seconds">seconds</span>
|
|
|
|
</span>
|
2015-06-13 19:46:07 +02:00
|
|
|
</div>
|
2016-04-20 20:47:23 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-protocol"><i class="fa fa-envelope"></i> <span data-i18n="email.label.protocol"></span></label>
|
|
|
|
<select type="text" id="node-input-protocol">
|
|
|
|
<option value="IMAP">IMAP</option>
|
|
|
|
<option value="POP3">POP3</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2016-08-03 09:55:39 +02:00
|
|
|
<label for="node-input-useSSL"><i class="fa fa-lock"></i> <span data-i18n="email.label.useSSL"></span></label>
|
|
|
|
<input type="checkbox" id="node-input-useSSL" style="width: auto;">
|
2016-04-20 20:47:23 +02:00
|
|
|
</div>
|
2015-06-13 19:46:07 +02:00
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="email.label.server"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-server" placeholder="imap.gmail.com">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-port"><i class="fa fa-random"></i> <span data-i18n="email.label.port"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-port" placeholder="993">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-userid"><i class="fa fa-user"></i> <span data-i18n="email.label.userid"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-userid">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-password"><i class="fa fa-lock"></i> <span data-i18n="email.label.password"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="password" id="node-input-password">
|
|
|
|
</div>
|
2016-04-20 20:47:23 +02:00
|
|
|
<div class="form-row node-input-box">
|
2015-06-16 11:36:19 +02:00
|
|
|
<label for="node-input-box"><i class="fa fa-inbox"></i> <span data-i18n="email.label.folder"></span></label>
|
2015-06-13 19:46:07 +02:00
|
|
|
<input type="text" id="node-input-box">
|
|
|
|
</div>
|
2016-04-20 20:47:23 +02:00
|
|
|
<div class="form-row node-input-disposition">
|
2016-08-03 09:55:39 +02:00
|
|
|
<label for="node-input-disposition"><i class="fa fa-trash"></i> <span data-i18n="email.label.disposition"></span></label>
|
2016-04-20 20:47:23 +02:00
|
|
|
<select type="text" id="node-input-disposition">
|
2017-07-12 19:16:43 +02:00
|
|
|
<option value="None" selected="selected" data-i18n="email.label.none"></option>
|
|
|
|
<option value="Read" data-i18n="email.label.read"></option>
|
|
|
|
<option value="Delete" data-i18n="email.label.delete"></option>
|
2016-04-20 20:47:23 +02:00
|
|
|
</select>
|
|
|
|
</div>
|
2019-02-11 20:26:45 +01:00
|
|
|
<div class="form-row">
|
2019-02-11 21:10:31 +01:00
|
|
|
<label for="node-input-criteria"><i class="fa fa-search"></i> <span data-i18n="email.label.criteria"></span></label>
|
2019-02-11 20:26:45 +01:00
|
|
|
<select type="text" id="node-input-criteria">
|
2019-02-11 21:10:31 +01:00
|
|
|
<option value="ALL" data-i18n="email.label.all"></option>
|
2019-02-11 20:26:45 +01:00
|
|
|
<option value="ANSWERED" data-i18n="email.label.answered"></option>
|
|
|
|
<option value="FLAGGED" data-i18n="email.label.flagged"></option>
|
2019-02-11 21:10:31 +01:00
|
|
|
<option value="SEEN" data-i18n="email.label.seen"></option>
|
|
|
|
<option value="UNANSWERED" data-i18n="email.label.unanswered"></option>
|
|
|
|
<option value="UNFLAGGED" data-i18n="email.label.unflagged"></option>
|
|
|
|
<option value="UNSEEN" selected="selected" data-i18n="email.label.unseen"></option>
|
2019-05-29 13:45:54 +02:00
|
|
|
<option value="_msg_" data-i18n="email.label.criteriaFromMsg"></option>
|
2019-02-11 20:26:45 +01:00
|
|
|
<!--
|
|
|
|
<option value="DELETED" data-i18n="email.label.delete"></option>
|
2019-02-11 21:10:31 +01:00
|
|
|
<option value="DRAFT" data-i18n="email.label.none"></option>
|
2019-02-11 20:26:45 +01:00
|
|
|
<option value="NEW" data-i18n="email.label.delete"></option>
|
|
|
|
<option value="UNDELETED" data-i18n="email.label.read"></option>
|
|
|
|
<option value="UNDRAFT" data-i18n="email.label.delete"></option>
|
|
|
|
<option value="RECENT" data-i18n="email.label.read"></option>
|
|
|
|
<option value="OLD" data-i18n="email.label.delete"></option>
|
|
|
|
-->
|
|
|
|
</select>
|
|
|
|
</div>
|
2015-06-13 19:46:07 +02:00
|
|
|
<br/>
|
|
|
|
<div class="form-row">
|
2015-06-16 12:16:29 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
|
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
2015-06-13 19:46:07 +02:00
|
|
|
</div>
|
2016-04-20 20:47:23 +02:00
|
|
|
<script>
|
|
|
|
var checkPorts = function() {
|
|
|
|
var currentPort = $("#node-input-port").val();
|
|
|
|
if (currentPort === "143" || currentPort === "993" || currentPort === "110" || currentPort == "995") {
|
|
|
|
if ($("#node-input-useSSL").prop("checked") === true) {
|
|
|
|
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"993":"995");
|
|
|
|
} else {
|
|
|
|
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"143":"110");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2016-05-19 11:13:47 +02:00
|
|
|
|
2016-04-20 20:47:23 +02:00
|
|
|
$("#node-input-useSSL").change(function(x, y) {
|
2019-01-31 22:00:31 +01:00
|
|
|
// console.log("useSSL: x="+ JSON.stringify(x) + ", y=" + y);
|
|
|
|
// console.log("Value: " + $("#node-input-useSSL").prop("checked"));
|
2016-04-20 20:47:23 +02:00
|
|
|
checkPorts();
|
|
|
|
});
|
2016-05-19 11:13:47 +02:00
|
|
|
|
2016-04-20 20:47:23 +02:00
|
|
|
$("#node-input-protocol").change(function() {
|
|
|
|
var protocol = $("#node-input-protocol").val();
|
|
|
|
if (protocol === "IMAP") {
|
|
|
|
$(".node-input-box").show();
|
|
|
|
$(".node-input-disposition").show();
|
2019-02-11 20:26:45 +01:00
|
|
|
$(".node-input-criteria").show();
|
2016-04-20 20:47:23 +02:00
|
|
|
} else {
|
|
|
|
$(".node-input-box").hide();
|
2016-05-19 11:13:47 +02:00
|
|
|
$(".node-input-disposition").hide();
|
2019-02-11 20:26:45 +01:00
|
|
|
$(".node-input-criteria").hide();
|
2016-04-20 20:47:23 +02:00
|
|
|
}
|
|
|
|
checkPorts();
|
|
|
|
});
|
|
|
|
</script>
|
2015-06-13 19:46:07 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
|
|
|
RED.nodes.registerType('e-mail in',{
|
|
|
|
category: 'social-input',
|
|
|
|
color:"#c7e9c0",
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
2016-04-20 20:47:23 +02:00
|
|
|
protocol: {value: "IMAP", required:true}, // Which protocol to use to connect to the mail server ("IMAP" or "POP3")
|
2015-06-13 19:46:07 +02:00
|
|
|
server: {value:"imap.gmail.com",required:true},
|
2016-04-20 20:47:23 +02:00
|
|
|
useSSL: {value: true},
|
2015-06-13 19:46:07 +02:00
|
|
|
port: {value:"993",required:true},
|
2016-05-19 11:13:47 +02:00
|
|
|
box: {value:"INBOX"}, // For IMAP, The mailbox to process
|
2016-12-12 22:14:32 +01:00
|
|
|
disposition: { value: "Read" }, // For IMAP, the disposition of the read email
|
2019-02-11 20:26:45 +01:00
|
|
|
criteria: {value: "UNSEEN"},
|
2019-01-31 22:00:31 +01:00
|
|
|
repeat: {value:"300",required:true},
|
|
|
|
fetch: {value:"auto"},
|
|
|
|
inputs: {value:0}
|
2015-06-13 19:46:07 +02:00
|
|
|
},
|
|
|
|
credentials: {
|
|
|
|
userid: {type:"text"},
|
|
|
|
password: {type: "password"},
|
|
|
|
global: { type:"boolean"}
|
|
|
|
},
|
2019-01-31 22:00:31 +01:00
|
|
|
inputs: 0,
|
|
|
|
outputs: 1,
|
2015-06-13 19:46:07 +02:00
|
|
|
icon: "envelope.png",
|
2018-03-30 15:50:51 +02:00
|
|
|
paletteLabel: function() {
|
2018-04-14 23:43:14 +02:00
|
|
|
return this._("email.email");
|
2018-03-30 15:50:51 +02:00
|
|
|
},
|
2015-06-13 19:46:07 +02:00
|
|
|
label: function() {
|
2018-03-30 15:50:51 +02:00
|
|
|
return this.name||this._("email.email");
|
2015-06-13 19:46:07 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
2018-03-20 18:18:20 +01:00
|
|
|
return (this.name)?"node_label_italic":"";
|
2015-06-13 19:46:07 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
2019-01-31 22:00:31 +01:00
|
|
|
var that = this;
|
2015-06-13 19:46:07 +02:00
|
|
|
if (this.credentials.global) {
|
|
|
|
$('#node-tip').show();
|
|
|
|
} else {
|
|
|
|
$('#node-tip').hide();
|
2015-06-16 15:38:36 +02:00
|
|
|
}
|
2015-06-13 19:46:07 +02:00
|
|
|
if (typeof this.box === 'undefined') {
|
|
|
|
$("#node-input-box").val("INBOX");
|
|
|
|
this.box = "INBOX";
|
|
|
|
}
|
2019-02-11 21:10:31 +01:00
|
|
|
if (typeof this.criteria === 'undefined') {
|
|
|
|
$("#node-input-criteria").val("UNSEEN");
|
|
|
|
this.criteria = "UNSEEN";
|
|
|
|
}
|
2019-01-31 22:00:31 +01:00
|
|
|
if ($("#node-input-fetch").val() === null) { $("#node-input-fetch").val("auto"); }
|
|
|
|
$("#node-input-fetch").change(function() {
|
|
|
|
if ($("#node-input-fetch").val() === "trigger") {
|
|
|
|
$('#node-repeatTime').hide();
|
|
|
|
that.inputs = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#node-repeatTime').show();
|
|
|
|
that.inputs = 0;
|
|
|
|
}
|
|
|
|
});
|
2015-06-13 19:46:07 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|