fix merge email.js

This commit is contained in:
Dave C-J 2014-09-03 19:34:52 +01:00
parent 7da7887ed2
commit fa8d31609e
1 changed files with 6 additions and 7 deletions

View File

@ -74,10 +74,9 @@ module.exports = function(RED) {
if (smtpTransport) {
node.status({fill:"blue",shape:"dot",text:"sending"});
var payload = RED.util.ensureString(msg.payload);
smtpTransport.sendMail({
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
text: payload // plaintext body
}, function(error, info) {
@ -178,7 +177,7 @@ module.exports = function(RED) {
pay.date = Imap.parseHeader(buffer).date[0];
} else {
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) {
pay.payload = parts[p].split("\n").slice(1,-2).join("\n").trim();
}