1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

fix merge email.js

This commit is contained in:
Dave C-J 2014-09-03 19:34:52 +01:00
parent 7da7887ed2
commit fa8d31609e

View File

@ -74,10 +74,9 @@ module.exports = function(RED) {
if (smtpTransport) { if (smtpTransport) {
node.status({fill:"blue",shape:"dot",text:"sending"}); node.status({fill:"blue",shape:"dot",text:"sending"});
var payload = RED.util.ensureString(msg.payload); var payload = RED.util.ensureString(msg.payload);
smtpTransport.sendMail({ smtpTransport.sendMail({
from: node.userid, // sender address from: node.userid, // sender address
to: node.name, // comma separated list of receivers to: msg.to || node.name, // comma separated list of addressees
subject: msg.topic, // subject line subject: msg.topic, // subject line
text: payload // plaintext body text: payload // plaintext body
}, function(error, info) { }, function(error, info) {
@ -178,7 +177,7 @@ module.exports = function(RED) {
pay.date = Imap.parseHeader(buffer).date[0]; pay.date = Imap.parseHeader(buffer).date[0];
} else { } else {
var parts = buffer.split("Content-Type"); var parts = buffer.split("Content-Type");
for (var p in parts) { for (var p = 0; p < parts.length; p++) {
if (parts[p].indexOf("text/plain") >= 0) { if (parts[p].indexOf("text/plain") >= 0) {
pay.payload = parts[p].split("\n").slice(1,-2).join("\n").trim(); pay.payload = parts[p].split("\n").slice(1,-2).join("\n").trim();
} }