Skip to content

Commit 6b2c4a3

Browse files
committed
fix formatting
1 parent 557f419 commit 6b2c4a3

File tree

1 file changed

+18
-42
lines changed

1 file changed

+18
-42
lines changed

articles/app-service/tutorial-send-email.md

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ In this tutorial, you learn how to integrate your App Service app with the busin
1616
- Connect to third-party systems like SAP, SalesForce, etc.
1717
- Exchange standard B2B messages
1818

19-
In this tutorial, you send emails from your App Service app using Gmail using [Azure Logic Apps](../logic-apps/logic-apps-overview.md). There are other ways to send emails from a web app, such as SMTP configuration provided by your language framework. However, Logic Apps brings a lot more power to your App Service app without adding complexity to your code. Logic Apps provides a simple configuration interface for the most popular business integrations, and your app can call them anytime with an
20-
HTTP request.
19+
In this tutorial, you send emails from your App Service app using Gmail using [Azure Logic Apps](../logic-apps/logic-apps-overview.md). There are other ways to send emails from a web app, such as SMTP configuration provided by your language framework. However, Logic Apps brings a lot more power to your App Service app without adding complexity to your code. Logic Apps provides a simple configuration interface for the most popular business integrations, and your app can call them anytime with an HTTP request.
2120

2221
## Prerequisite
2322

@@ -52,13 +51,10 @@ Deploy an app with the language framework of your choice to App Service. To foll
5251
## Create the Logic App
5352

5453
1. In the [Azure portal](https://portal.azure.com), create an empty logic app by following the instructions in [Create your logic app](../logic-apps/quickstart-create-first-logic-app-workflow.md#create-your-logic-app). When you see the **Logic Apps Designer**, return to this tutorial.
55-
1. In the splash page for Logic Apps Designer, select **When a
56-
HTTP request is received** under **Start with a common trigger**.
54+
1. In the splash page for Logic Apps Designer, select **When an HTTP request is received** under **Start with a common trigger**.
5755

58-
![](./media/tutorial-send-email/receive
59-
-http-request.png)
60-
1. In the dialog for **When a
61-
HTTP request is received**, select **Use sample payload to generate schema**.
56+
![](./media/tutorial-send-email/receive-http-request.png)
57+
1. In the dialog for **When an HTTP request is received**, select **Use sample payload to generate schema**.
6258

6359
![](./media/tutorial-send-email/generate-schema-with-payload.png)
6460

@@ -72,20 +68,14 @@ Deploy an app with the language framework of your choice to App Service. To foll
7268
}
7369
```
7470

75-
The schema is now generated fo
76-
r the request data you want. In practice, you can just capture the a
77-
ctual request data your application code generates and let Azure generate the JSON schema for you.
71+
The schema is now generated for the request data you want. In practice, you can just capture the actual request data your application code generates and let Azure generate the JSON schema for you.
7872
1. At the top of the Logic Apps Designer, select **Save**.
7973

80-
You can now see the URL of your
81-
HTTP request trigger.
74+
You can now see the URL of your HTTP request trigger.
8275

8376
![](./media/tutorial-send-email/generate-schema-with-payload.png)
8477

85-
This
86-
HTTP request definition is a trigger to anything you want to do in this logic app, be it Gmail or anything else. Later you will invoke this URL in your App Service app. For more information o
87-
n the request trigger, see the
88-
[HTTP request/response reference](../connectors/connectors-native-reqres.md).
78+
This HTTP request definition is a trigger to anything you want to do in this logic app, be it Gmail or anything else. Later you will invoke this URL in your App Service app. For more information on the request trigger, see the [HTTP request/response reference](../connectors/connectors-native-reqres.md).
8979

9080
1. At the bottom of the designer, click **New step**, type **Gmail** in the actions search box and find and select **Send email (V2)**.
9181

@@ -97,13 +87,11 @@ Deploy an app with the language framework of your choice to App Service. To foll
9787

9888
1. Once signed in, click in the **To** textbox, and the dynamic content dialog is automatically opened.
9989

100-
1. Next to the **When a
101-
HTTP request is received** action, select **See more**.
90+
1. Next to the **When an HTTP request is received** action, select **See more**.
10291

10392
![](./media/tutorial-send-email/expand-dynamic-content.png)
10493

105-
You should now see the three properties from your sample JSON data you used earlier. In this step, you use these properties from the
106-
HTTP request to construct an email.
94+
You should now see the three properties from your sample JSON data you used earlier. In this step, you use these properties from the HTTP request to construct an email.
10795
1. Since you're selecting the value for the **To** field, choose **email**. If you want, toggle off the dynamic content dialog by clicking **Add dynamic content**.
10896

10997
![](./media/tutorial-send-email/hide-dynamic-content.png)
@@ -127,24 +115,20 @@ Deploy an app with the language framework of your choice to App Service. To foll
127115

128116
![](./media/tutorial-send-email/choose-response-action.png)
129117

130-
By default, the response action sends an HTTP 200. That's good enough for this tutorial. For more information, see the
131-
[HTTP request/response reference](../connectors/connectors-native-reqres.md).
118+
By default, the response action sends an HTTP 200. That's good enough for this tutorial. For more information, see the [HTTP request/response reference](../connectors/connectors-native-reqres.md).
132119

133120
1. At the top of the Logic Apps Designer, select **Save** again.
134121

135-
## Add
136-
HTTP request code to app
122+
## Add HTTP request code to app
137123

138-
Make sure you have copied the URL of the
139-
HTTP request trigger from earlier. First, create an app setting in your App Service app. In the [Cloud Shell](https://shell.azure.com), you can do it with the following command (replace *\<app-name>*, *\<resource-group-name>*, and *\<logic-app-url>*):
124+
Make sure you have copied the URL of the HTTP request trigger from earlier. First, create an app setting in your App Service app. In the [Cloud Shell](https://shell.azure.com), you can do it with the following command (replace *\<app-name>*, *\<resource-group-name>*, and *\<logic-app-url>*):
140125

141126
```azurecli-interactive
142127
az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings LOGIC_APP_URL="<your-logic-app-url>"
143128
```
144129

145130
In your code, make a standard HTTP post to the URL using any HTTP client language that's available to your language framework, with the following configuration:
146131

147-
148132
- The request body contains the same JSON format that you supplied to your logic app:
149133

150134
```json
@@ -156,8 +140,7 @@ In your code, make a standard HTTP post to the URL using any HTTP client languag
156140
```
157141

158142
- The request contains the heading `Content-Type: application/json`.
159-
- To optimize performance, sen
160-
d the request asynchronously if possible.
143+
- To optimize performance, send the request asynchronously if possible.
161144

162145
Click on the preferred language/framework tab below to see an example.
163146

@@ -210,9 +193,7 @@ var statusCode = result.StatusCode.ToString();
210193
```
211194

212195
> [!NOTE]
213-
> This code is written for simplicity of demonstration. In practice, don't instantiate an `HttpClient` object for
214-
each request. Follow the guidance at [Use IHttpClientFactory to implement resilient
215-
HTTP requests](https://docs.microsoft.com/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient
196+
> This code is written for simplicity of demonstration. In practice, don't instantiate an `HttpClient` object for each request. Follow the guidance at [Use IHttpClientFactory to implement resilient HTTP requests](https://docs.microsoft.com/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient
216197
-http-requests).
217198

218199
If you're testing this code on the sample app for [Tutorial: Build an ASP.NET Core and SQL Database app in Azure App Service](app-service-web-tutorial-dotnetcore-sqldb.md), you could use it to send an email confirmation in the [Create action](https://github.com/Azure-Samples/dotnetcore-sqldb-tutorial/blob/master/Controllers/TodosController.cs#L56-L65), after the `Todo` item is added.
@@ -278,23 +259,18 @@ If you're testing this code on the sample app for [Tutorial: Build a PHP and MyS
278259

279260
# [Python](#tab/python)
280261

281-
In Python, you can send the HTTP post easily
282-
with [requests](https://pypi.org/pr
283-
oject/requests/). For example:
262+
In Python, you can send the HTTP post easily with [requests](https://pypi.org/project/requests/). For example:
284263

285264
```python
286-
# Requires pip in
287-
stall requests && pip freeze > requirements.txt
288-
i
289-
mport requests
265+
# Requires pip install requests && pip freeze > requirements.txt
266+
import requests
290267
...
291268
payload = {
292269
"email": "[email protected]",
293270
"due": "4/1/2020",
294271
"task": "My new task!"
295272
}
296-
respo
297-
nse = requests.post("https://prod-112.westeurope.logic.azure.com:443/workfl$
273+
response = requests.post("https://prod-112.westeurope.logic.azure.com:443/workfl$
298274
print(response.status_code)
299275
```
300276
<!-- ```python

0 commit comments

Comments
 (0)