mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #470 from anna2130/msg-property-overrides
Message properties overriding set node properties
This commit is contained in:
@@ -70,8 +70,8 @@
|
||||
|
||||
<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>
|
||||
<p>The default message recipient can be configured in the node, if it is left blank it should be set in an incoming message on <b>msg.to</b>.</p>
|
||||
<!-- <p>It sends the message to the configured recipient <i>only</i>.</p> -->
|
||||
<p>You may dynamically overide the default recipient by setting a <b>msg.to</b> property.</p>
|
||||
<!-- <p><b>msg.topic</b> is used to set the subject of the email, and <b>msg.payload</b> is the body text.</p> -->
|
||||
</script>
|
||||
|
||||
|
@@ -72,6 +72,9 @@ module.exports = function(RED) {
|
||||
if (smtpTransport) {
|
||||
node.status({fill:"blue",shape:"dot",text:"sending"});
|
||||
var payload = RED.util.ensureString(msg.payload);
|
||||
if (msg.to && node.name) {
|
||||
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
|
||||
}
|
||||
smtpTransport.sendMail({
|
||||
from: node.userid, // sender address
|
||||
to: msg.to || node.name, // comma separated list of addressees
|
||||
@@ -243,4 +246,4 @@ module.exports = function(RED) {
|
||||
global: { type:"boolean"}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user