2013-09-05 16:02:48 +02:00
|
|
|
<!--
|
2014-05-13 12:39:59 +02:00
|
|
|
Copyright 2013,2014 IBM Corp.
|
2013-09-05 16:02:48 +02:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
2014-05-02 15:37:41 +02:00
|
|
|
<script type="text/x-red" data-template-name="e-mail">
|
2013-09-05 16:02:48 +02:00
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-envelope"></i> To</label>
|
2013-09-05 16:02:48 +02:00
|
|
|
<input type="text" id="node-input-name" placeholder="email@address.com">
|
|
|
|
</div>
|
2014-05-02 15:37:41 +02:00
|
|
|
<!-- <div class="form-row">
|
2014-09-03 16:11:10 +02:00
|
|
|
<label for="node-input-pin"><i class="fa fa-asterisk"></i> Service</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<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">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-server"><i class="fa fa-globe"></i> Server</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-server" placeholder="smtp.gmail.com">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-port"><i class="fa fa-random"></i> Port</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-port" placeholder="465">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-userid"><i class="fa fa-user"></i> Userid</label>
|
2014-08-18 18:15:14 +02:00
|
|
|
<input type="text" id="node-input-userid">
|
2014-05-02 15:37:41 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
|
2014-08-18 18:15:14 +02:00
|
|
|
<input type="password" id="node-input-password">
|
2014-05-02 15:37:41 +02:00
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-dname"><i class="fa fa-tag"></i> Name</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-dname" placeholder="Name">
|
|
|
|
</div>
|
2014-08-18 18:15:14 +02:00
|
|
|
<div class="form-tips" id="node-tip"><b>Note:</b> Copied credentials from global emailkeys.js file.</div>
|
2013-09-05 16:02:48 +02:00
|
|
|
</script>
|
|
|
|
|
2014-05-02 15:37:41 +02:00
|
|
|
<script type="text/x-red" data-help-name="e-mail">
|
|
|
|
<p>Sends the <b>msg.payload</b> as an email, with a subject of <b>msg.topic</b>.</p>
|
2015-02-08 12:33:04 +01:00
|
|
|
<p>The default message recipient can be configured in the node, if it is left
|
|
|
|
blank it should be set using the <b>msg.to</b> property of the incoming message.</p>
|
|
|
|
<p>The payload can be html format.</p>
|
|
|
|
<p>If the payload is a binary buffer then it will be converted to an attachment.
|
2015-02-08 16:02:02 +01:00
|
|
|
The filename should be set using <b>msg.filename</b>. Optionally <b>msg.description</b> can be added for the body text.</p>
|
2015-02-08 12:33:04 +01:00
|
|
|
<p>Alternatively you may provide <b>msg.attachments</b> which should contain an array of one or
|
|
|
|
more attachments in <a href="https://www.npmjs.com/package/nodemailer#attachments" target="_new">nodemailer</a> format.</p>
|
2013-09-05 16:02:48 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2014-05-02 15:37:41 +02:00
|
|
|
(function() {
|
|
|
|
RED.nodes.registerType('e-mail',{
|
2013-09-05 16:02:48 +02:00
|
|
|
category: 'social-output',
|
|
|
|
color:"#c7e9c0",
|
|
|
|
defaults: {
|
2014-05-02 15:37:41 +02:00
|
|
|
server: {value:"smtp.gmail.com",required:true},
|
|
|
|
port: {value:"465",required:true},
|
2015-03-19 22:25:43 +01:00
|
|
|
name: {value:""},
|
2014-05-02 15:37:41 +02:00
|
|
|
dname: {value:""}
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
2014-08-18 18:15:14 +02:00
|
|
|
credentials: {
|
|
|
|
userid: {type:"text"},
|
|
|
|
password: {type: "password"},
|
|
|
|
global: { type:"boolean"}
|
2014-09-04 09:20:13 +02:00
|
|
|
},
|
2013-09-05 16:02:48 +02:00
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "envelope.png",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
2014-05-02 15:37:41 +02:00
|
|
|
return this.dname||this.name||"email";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return (this.dname||!this.topic)?"node_label_italic":"";
|
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
2014-08-18 18:15:14 +02:00
|
|
|
if (this.credentials.global) {
|
|
|
|
$('#node-tip').show();
|
|
|
|
} else {
|
|
|
|
$('#node-tip').hide();
|
|
|
|
};
|
2014-05-02 15:37:41 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="e-mail in">
|
|
|
|
<div class="form-row node-input-repeat">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-repeat"><i class="fa fa-repeat"></i> Check Repeat (S)</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-repeat" placeholder="300">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-server"><i class="fa fa-globe"></i> Server</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-server" placeholder="imap.gmail.com">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-port"><i class="fa fa-random"></i> Port</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-port" placeholder="993">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-userid"><i class="fa fa-user"></i> Userid</label>
|
2014-08-18 18:15:14 +02:00
|
|
|
<input type="text" id="node-input-userid">
|
2014-05-02 15:37:41 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-04-11 17:09:13 +02:00
|
|
|
<label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
|
2014-08-18 18:15:14 +02:00
|
|
|
<input type="password" id="node-input-password">
|
2014-05-02 15:37:41 +02:00
|
|
|
</div>
|
2015-04-11 17:09:13 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-box"><i class="fa fa-inbox"></i> Folder</label>
|
|
|
|
<input type="text" id="node-input-box">
|
|
|
|
</div>
|
2014-05-02 15:37:41 +02:00
|
|
|
<br/>
|
|
|
|
<div class="form-row">
|
2014-09-04 09:20:13 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
2014-05-02 15:37:41 +02:00
|
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
|
|
</div>
|
2014-08-18 18:15:14 +02:00
|
|
|
<div class="form-tips" id="node-tip"><b>Note:</b> Copied credentials from global emailkeys.js file.</div>
|
2014-05-02 15:37:41 +02:00
|
|
|
<div id="node-input-tip" class="form-tips">Tip: <b>ONLY</b> retrieves the single most recent email.</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="e-mail in">
|
|
|
|
<p>Repeatedly gets a <b>single email</b> from an IMAP server and forwards on as a msg if not already seen.</p>
|
|
|
|
<p>The subject is loaded into <b>msg.topic</b> and <b>msg.payload</b> is the plain text body.
|
|
|
|
If there is text/html then that is returned in <b>msg.html</b>. <b>msg.from</b> and <b>msg.date</b> are also set if you need them.</p>
|
2015-04-12 01:46:03 +02:00
|
|
|
<p>Additionally <b>msg.header</b> contains the complete header object including
|
|
|
|
<i>to</i>, <i>cc</i> and other potentially useful properties.</p>
|
2014-05-02 15:37:41 +02:00
|
|
|
<p>Uses the imap module.</p>
|
|
|
|
<p><b>Note:</b> this node <i>only</i> gets the most recent single email from the inbox, so set the repeat (polling) time appropriately.</p>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
|
|
|
RED.nodes.registerType('e-mail in',{
|
|
|
|
category: 'social-input',
|
|
|
|
color:"#c7e9c0",
|
|
|
|
defaults: {
|
2015-04-11 17:09:13 +02:00
|
|
|
name: {value:""},
|
2014-05-02 15:37:41 +02:00
|
|
|
server: {value:"imap.gmail.com",required:true},
|
|
|
|
port: {value:"993",required:true},
|
2015-04-11 17:09:13 +02:00
|
|
|
box: {value:"INBOX"},
|
|
|
|
repeat: {value:"300",required:true}
|
2014-05-02 15:37:41 +02:00
|
|
|
},
|
2014-08-18 18:15:14 +02:00
|
|
|
credentials: {
|
|
|
|
userid: {type:"text"},
|
|
|
|
password: {type: "password"},
|
|
|
|
global: { type:"boolean"}
|
|
|
|
},
|
2014-05-02 15:37:41 +02:00
|
|
|
inputs:0,
|
|
|
|
outputs:1,
|
|
|
|
icon: "envelope.png",
|
|
|
|
label: function() {
|
|
|
|
return this.name||"email";
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return (this.name||!this.topic)?"node_label_italic":"";
|
2014-05-02 15:37:41 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
2014-08-18 18:15:14 +02:00
|
|
|
if (this.credentials.global) {
|
|
|
|
$('#node-tip').show();
|
|
|
|
} else {
|
|
|
|
$('#node-tip').hide();
|
|
|
|
};
|
2015-04-11 17:09:13 +02:00
|
|
|
if (typeof this.box === 'undefined') {
|
|
|
|
$("#node-input-box").val("INBOX");
|
|
|
|
this.box = "INBOX";
|
|
|
|
}
|
2013-09-05 16:02:48 +02:00
|
|
|
}
|
|
|
|
});
|
2014-05-02 15:37:41 +02:00
|
|
|
})();
|
2013-09-05 16:02:48 +02:00
|
|
|
</script>
|