-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmailwithAttachment.JSON
127 lines (126 loc) · 6.08 KB
/
EmailwithAttachment.JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"LogicAppName": {
"defaultValue": "send-email-with-attachment",
"type": "String"
}
},
"variables": {
"LogicAppName": "[parameters('LogicAppName')]",
"office365": "[concat('office365-', parameters('LogicAppName'))]"
},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('LogicAppName')]",
"location": "[resourceGroup().location]",
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_blob_is_added_or_modified_(properties_only)_(V2)": {
"recurrence": {
"frequency": "Second",
"interval": 5
},
"evaluatedRecurrence": {
"frequency": "Second",
"interval": 5
},
"splitOn": "@triggerBody()",
"metadata": {
"JTJmZW1haWw=": "/email"
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/triggers/batch/onupdatedfile",
"queries": {
"checkBothCreatedAndModifiedDateTime": false,
"folderId": "JTJmZW1haWw=",
"maxFileCount": 1
}
}
}
},
"actions": {
"Get_blob_content_(V2)": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/email/',triggerBody()?['Name']))}/content"
}
},
"Send_an_email_(V2)": {
"runAfter": {
"Get_blob_content_(V2)": [
"Succeeded"
]
},
"type": "ApiConnection",
"inputs": {
"body": {
"Attachments": [
{
"ContentBytes": "@{base64(body('Get_blob_content_(V2)'))}",
"Name": "@triggerBody()?['Name']"
}
],
"Body": "<p>Hello ,<br>\n<br>\nThis is automated mail from the Azure logic app</p>",
"Subject": "Auto Mail from Logic App ",
"To": "[email protected]"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azureblob_1": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('LogicAppName'))]",
"connectionName": "[variables('LogicAppName')]",
"id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', parameters('location'), 'azureblob')]"
},
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', variables('office365'))]",
"connectionName": "[variables('office365')]",
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
}
}
}
]
}