node-red发邮件的代码
时间: 2023-10-24 16:05:29 浏览: 164
下面是使用 Node-RED 发送邮件的代码:
```
[{"id":"41f5f79.63a35c8","type":"e-mail","z":"b8a2b5ef.5e4508","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"发送邮件","dname":"","x":560,"y":180,"wires":[]},{"id":"2f4c1c1e.23d6c6","type":"inject","z":"b8a2b5ef.5e4508","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"to\":\"收件人邮箱\",\"subject\":\"邮件标题\",\"message\":\"邮件正文\"}","payloadType":"json","x":200,"y":180,"wires":[["41f5f79.63a35c8"]]},{"id":"d81e8af4.8b6708","type":"comment","z":"b8a2b5ef.5e4508","name":"发送邮件示例","info":"","x":190,"y":100,"wires":[]}]
```
其中 `to`、`subject` 和 `message` 分别代表收件人邮箱、邮件标题和邮件正文。在实际使用时,需要将 `server` 和 `port` 改为相应的邮箱服务器和端口,同时输入正确的发件人邮箱和密码。
阅读全文