[CCSDK-28] populated the seed code for dgbuilder
[ccsdk/distribution.git] / dgbuilder / core_nodes / deprecated / 61-imap.html
1 <!--
2   Copyright 2013 IBM Corp.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 -->
16
17 <script type="text/x-red" data-template-name="imap">
18     <div class="form-row node-input-repeat">
19         <label for="node-input-repeat"><i class="fa fa-repeat"></i>Repeat (S)</label>
20         <input type="text" id="node-input-repeat" placeholder="300">
21     </div>
22     <div class="form-row">
23         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
24         <input type="text" id="node-input-name" placeholder="Name">
25     </div>
26 </script>
27
28 <script type="text/x-red" data-help-name="imap">
29     <p>Repeatedly gets a <b>single email</b> from an IMAP server and forwards on as a msg if not already seen.</p>
30     <p>The subject is loaded into <b>msg.topic</b> and <b>msg.payload</b> is the plain text body.
31        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>
32     <p>Uses the imap module - you also need to pre-configure your email settings in a file emailkeys.js as per below.</p>
33     <p><pre>module.exports = { service: "Gmail", user: "blahblah@gmail.com", pass: "password", server: "imap.gmail.com", port: "993" }</pre></p>
34     <p>This <b>must</b> be located in the directory <b>above</b> node-red.</p>
35     <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>
36 </script>
37
38 <script type="text/javascript">
39     RED.nodes.registerType('imap',{
40         category: 'deprecated',
41         color:"#c7e9c0",
42         defaults: {
43             repeat: {value:"300",required:true},
44             name: {value:""}
45         },
46         inputs:0,
47         outputs:1,
48         icon: "envelope.png",
49         label: function() {
50             return this.name||"IMAP";
51         },
52         labelStyle: function() {
53             return (this.name||!this.topic)?"node_label_italic":"";
54         }
55     });
56 </script>