Getting no response sending mail in bot framework using smtp.
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
var activity = await result as IMessageActivity;
try
{
var smtpClient = new SmtpClient
{
Host = "smtp-mail.outlook.com", // set your SMTP server name here
Port = 25, // Port
EnableSsl = false,
Credentials = new NetworkCredential("email@acc.com", "***")
};
using (var message = new MailMessage("email@acc.com", "email@acc.com")
{
Subject = "Hello",
Body = " Dear "
})
await smtpClient.SendMailAsync(message);
}
catch (Exception e)
{
await context.PostAsync($"{e.Message}");
}
await context.PostAsync("generating your quote");
context.Wait(MessageReceivedAsync);
}
I expect the code to send a mail after putting in valid email and credentials but it does not. I tried it in a console application and it did send mail. I tried implementing smtp in form flow but the code failed to proceed during execution.