Connect a bot to Office 365 email
APPLIES TO: SDK v4
Bots can communicate with users via Office 365 email in addition to other channels. When a bot is configured to access an email account, it receives a message when a new email arrives. The bot can then respond as indicated by its business logic. For example, the bot could send an email reply acknowledging an email was received with the message, "Hi! Thanks for your order! We will begin processing it immediately."
Warning
It's a violation of the Bot Framework Code of Conduct to create "spambots", including bots that send unwanted or unsolicited bulk email.
Note
If you are using Microsoft Exchange Server, make sure you have enabled Autodiscover first before configuring email channel.
Configure email credentials
You can connect a bot to the Email channel by entering Office 365 credentials in the Email channel configuration. Federated authentication using any vendor that replaces AAD is not supported.
Note
You should not use your own personal email accounts for bots, as every message sent to that email account will be forwarded to the bot. This can result in the bot inappropriately sending a response to a sender. For this reason, bots should only use dedicated O365 email accounts.
To add the Email channel, open the bot in the Azure Portal, click the Channels blade, and then click Email. Enter your valid email credentials and click Save.

The Email channel currently works with Office 365 only. Other email services are not currently supported.
Customize emails
The Email channel supports sending custom values to create more advanced, customized emails by using the activity channelData property.
The snippet below shows an example of the channelData for an incoming custom email message, from the bot to the user.
{
"type": "ActivityTypes.Message",
"locale": "en-Us",
"channelID": "email",
"fromName": { "id": "mybot@mydomain.com", "name": "My bot"},
"recipientName": { "id": "joe@otherdomain.com", "name": "Joe Doe"},
"conversation": { "id": "123123123123", "topic": "awesome chat" },
"channelData":
{
"htmlBody": "<html><body style = \"font-family: Calibri; font-size: 11pt;\" >This is more than awesome.</body></html>",
"importance": "high",
"ccRecipients": "Yasemin@adatum.com;Temel@adventure-works.com",
}
}
For more information about the activity channelData property, see Create a custom Email message.
Other considerations
If your bot does not return a 200 OK HTTP status code within 15 seconds in response to an incoming email message, the email channel will try to resend the message, and your bot may receive the same email message activity a few times. For more information, see the HTTP details section in How bots work and the how to troubleshooting timeout errors article.
Note
If you are using an Office 365 account with MFA enabled on it, make sure you disable MFA for the specified account first, then you can configure the account for the email channel. Otherwise, the connection will fail.
Additional resources
- Connect a bot to channels
- Implement channel-specific functionality with the Bot Framework SDK for .NET
- Read the channels reference article for more information about which features are supported on each channel