逻辑应用程序 - 发送电子邮件 v2 - 动态内容

问题描述 投票:0回答:1

当我将动态内容功能添加到我的电子邮件正文中时,如图所示,它们无法显示。有哪位聪明人可以告诉我为什么吗?

另外,我该如何解决这个问题?我不是 html 开发人员。

这可以通过简单的拖放来修复吗?还是逻辑应用程序中的一个错误需要将其写入?

任何帮助都会很棒。

我一直拖变量和解析json函数都没有用。

我不是开发人员,所以如果这里有问题,我真的很感激一些指示?

我怀疑解析 json 输出和生成的发送电子邮件 v2 输出之间存在某种分歧:

parse json output:

    {
    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['office365']['connectionId']"
            }
        },
        "method": "post",
        "body": {
            "To": "[email protected]",
            "Subject": "POSITIVE:  REG APP EXP @{variables('displayName')} ",
            "Body": "<p>appid : &nbsp;&nbsp;@{body('Parse_JSON')?['properties']?['value']?['type']?['type']?['type']?['items']?['type']?['properties']?['appId']}<br>\n<br>\n<br>\nappid : @{body('Parse_JSON')?['d']?['properties']?['value']?['items']?['properties']?['appId']}<br>\n</p>",
            "Importance": "Normal"
        },
        "path": "/v2/Mail",
        "authentication": "@parameters('$authentication')"
    }
}

and the parse json body:

    
{
    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['office365']['connectionId']"
            }
        },
        "method": "post",
        "body": {
            "To": "[email protected]",
            "Subject": "POSITIVE:  REG APP EXP @{variables('displayName')} ",
            "Body": "<p>appid : &nbsp;&nbsp;@{body('Parse_JSON')?['properties']?['value']?['type']?['type']?['type']?['items']?['type']?['properties']?['appId']}<br>\n<br>\n<br>\nappid : @{body('Parse_JSON')?['d']?['properties']?['value']?['items']?['properties']?['appId']}<br>\n</p>",
            "Importance": "Normal"
        },
        "path": "/v2/Mail",
        "authentication": "@parameters('$authentication')"
    }
}


***********************
{
    "properties": {
        "properties": {
            "properties": {
                "@@@odata.context": {
                    "properties": {
                        "type": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    "type": "object"
                },
                "@@@odata.nextLink": {
                    "properties": {
                        "type": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    "type": "object"
                },
                "value": {
                    "properties": {
                        "items": {
                            "properties": {
                                "properties": {
                                    "properties": {
                                        "appId": {
                                            "properties": {
                                                "type": {
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "type": "array"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "displayName": {
                                            "properties": {
                                                "type": {
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "type": "array"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "id": {
                                            "properties": {
                                                "type": {
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "type": "array"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "passwordCredentials": {
                                            "properties": {
                                                "items": {
                                                    "properties": {
                                                        "properties": {
                                                            "properties": {
                                                                "customKeyIdentifier": {
                                                                    "properties": {
                                                                        "type": {
                                                                            "items": {
                                                                                "type": "string"
                                                                            },
                                                                            "type": "array"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                },
                                                                "displayName": {
                                                                    "properties": {},
                                                                    "type": "object"
                                                                },
                                                                "endDateTime": {
                                                                    "properties": {
                                                                        "type": {
                                                                            "items": {
                                                                                "type": "string"
                                                                            },
                                                                            "type": "array"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                },
                                                                "hint": {
                                                                    "properties": {},
                                                                    "type": "object"
                                                                },
                                                                "keyId": {
                                                                    "properties": {
                                                                        "type": {
                                                                            "items": {
                                                                                "type": "string"
                                                                            },
                                                                            "type": "array"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                },
                                                                "secretText": {
                                                                    "properties": {},
                                                                    "type": "object"
                                                                },
                                                                "startDateTime": {
                                                                    "properties": {
                                                                        "type": {
                                                                            "items": {
                                                                                "type": "string"
                                                                            },
                                                                            "type": "array"
                                                                        }
                                                                    },
                                                                    "type": "object"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "required": {
                                                            "items": {
                                                                "type": "string"
                                                            },
                                                            "type": "array"
                                                        },
                                                        "type": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "type": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                },
                                "required": {
                                    "items": {
                                        "type": "string"
                                    },
                                    "type": "array"
                                },
                                "type": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "type": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        },
        "type": {
            "type": "string"
        }
    },
    "type": "object"
}
office365 azure-logic-apps dynamic-content
1个回答
0
投票

当我将动态内容功能添加到我的电子邮件正文中时,如图所示,它们无法显示。

您可以从电子邮件正文中的动态内容中获取值,如下所示-

enter image description here

代码-

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Data": {
                "inputs": {
                    "variables": [
                        {
                        "name": "Data",
                            "type": "string",
                            "value": "{\n\"FirstName\": \"Ikhtesam\",\n\"LastName\": \"Afrin\"\n}"
                        }
                    ]
                },
                "runAfter": {
                    "Display_Name": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Display_Name": {
                "inputs": {
                    "variables": [
                        {
                        "name": "DisplayName",
                            "type": "string",
                            "value": "TestSecret"
                        }
                    ]
                },
                "runAfter": { },
                "type": "InitializeVariable"
            },
            "Parse_JSON": {
                "inputs": {
                    "content": "@variables('Data')",
                    "schema": {
                        "properties": {
                            "FirstName": {
                                "type": "string"
                            },
                            "LastName": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "runAfter": {
                    "Data": [
                        "Succeeded"
                    ]
                },
                "type": "ParseJson"
            },
            "Send_an_email_(V2)": {
                "inputs": {
                    "body": {
                        "Body": "<p><strong>This is a onfirmation email-</strong><br>\n<br>\nVariables display name: @{variables('DisplayName')}<br>\n<br>\nFirstName is: @{body('Parse_JSON')?['FirstName']}<br>\n<br>\nLastName is: @{body('Parse_JSON')?['LastName']}</p>",
                        "Importance": "Normal",
                        "Subject": "POSITIVE Secret expired @{variables('DisplayName')}",
                        "To": "*****@xyz.com"
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['office365']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/v2/Mail"
                },
                "runAfter": {
                    "Parse_JSON": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": { },
        "parameters": {
            "$connections": {
                "defaultValue": { },
                "type": "Object"
            }
        },
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": { }
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {
        "$connections": {
            "value": {
                "office365": {
                    "connectionId": "/subscriptions/**************/resourceGroups/*********/providers/Microsoft.Web/connections/office365",
                    "connectionName": "office365",
                    "id": "/subscriptions/***********/providers/Microsoft.Web/locations/eastus/managedApis/office365"
                }
            }
        }
    }
}

我收到了包含所有值的电子邮件。

enter image description here

您可以根据您的要求格式化电子邮件正文。

© www.soinside.com 2019 - 2024. All rights reserved.