BotFramework-WebChat
BotFramework-WebChat copied to clipboard
Email is not working in Bot.
Hello. I am using .net bot framework. I create an email function. Email function is working fine on emulator but when i go live on azure bot don't sending email go to exception and give me error. please help me out how can i solve this issue.
On Direct-line channel after email send button click it give me error :"There was an error sending this message to your bot: HTTP status code InternalServerError".
`using System.Net;
using System.Net.Mail;
var fromAddress = new MailAddress("[email protected]", "From Name");
var toAddress = new MailAddress("[email protected]", "To Name");
const string fromPassword = "fromPassword";
const string subject = "Subject";
const string body = "Body";
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}`
Thanks