I have looked all over to find a solution to run an intent that sends an email but cannot find any solutions. Can anyone help?
You can use nodemailer in your dialogflow webhook fulfillment intent to send emails.
Make sure to enable less secure apps here to use gmail to send emails.
Code for sending emails using nodemailer from your intent :
app.intent('sendMail', (conv, params) => {
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'yourPassword'
}
});
var mailOptions = {
from: '[email protected]',
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);
}
});
});
If you are using inline editor follow this for assistance.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With