2

I have an example bot created using FormFlow:

public static IForm<SandwichOrder> BuildForm()
        {
            OnCompletionAsyncDelegate<SandwichOrder> processOrder = async (context, state) =>
            {
                await context.PostAsync("We are currently processing your sandwich. We will message you the status.");
            };

            return new FormBuilder<SandwichOrder>()
                        .Message("Welcome to the sandwich order bot!")
                        .Field(nameof(Sandwich))
                        .Field(nameof(Length))
                        .Field(nameof(Bread))
                        .Field(nameof(Cheese))
                        .AddRemainingFields()
                        .Message("Thanks for ordering a sandwich!")
                        .OnCompletion(processOrder)
                        .Build();
    }

On completion of form, the control comes at:

OnCompletionAsyncDelegate<SandwichOrder> processOrder = async (context, state) =>
                {
                    await context.PostAsync("We are currently processing your sandwich. We will message you the status.");
                };

I want to send an email to myself with all the form fields. How can I connect with SMTP and write an email function to send an email with all selected options and inputs from user?

dang
  • 2,342
  • 5
  • 44
  • 91

1 Answers1

3

This question is not related to Botframework, it's only "how to send an email from C#".

You have several options, like:

  • using SendGrid
  • using SMTPClient (have a look here for example: Send e-mail via SMTP using C#)
  • using Graph API if you use Office 365 accounts (or on premises but it depends on the configuration etc.)
  • using EWS (Exchange Web Services)
  • other ways...

The fields that you want to put in your email are contained in the state variable

Nicolas R
  • 13,812
  • 2
  • 28
  • 57