Yur*_*ves 1 actions-on-google dialogflow-es
我四处寻找可以找到一种解决方案,该方案可以运行发送电子邮件但无法找到任何解决方案的意图。有人可以帮忙吗?
您可以在dialogflow Webhook实现意图中使用nodemailer发送电子邮件。
确保在此处启用安全性较低的应用程序,以使用gmail发送电子邮件。
从您的意图使用nodemailer发送电子邮件的代码:
app.intent('sendMail', (conv, params) => {
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourPassword'
}
});
var mailOptions = {
from: 'youremail@gmail.com',
to: email, //receiver email
subject: 'Mail subject',
text: 'mail body'
};
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
});
Run Code Online (Sandbox Code Playgroud)
如果您正在使用行内编辑遵循此寻求帮助。
希望有帮助!
| 归档时间: |
|
| 查看次数: |
2136 次 |
| 最近记录: |