简体   繁体   English

在逻辑应用程序上使用从共享邮箱发送电子邮件 (V2) 发送 HTML 电子邮件

[英]Sending a HTML Email using Send an Email from Shared Mailbox (V2) on Logic Apps

I'm a beginner user of Azure and Logic Apps and Stack overflow and I'm trying to send a customised email using Logic Apps on Microsoft Azure.我是 Azure 和逻辑应用程序以及堆栈溢出的初学者用户,我正在尝试使用 Microsoft Azure 上的逻辑应用程序发送自定义电子邮件。

I'm using the following guide (see below) to set my template onto a Logic App flow but I am facing issues with setting the HTML variable.我正在使用以下指南(见下文)将我的模板设置到逻辑应用程序流上,但我在设置 HTML 变量时遇到了问题。 When I set the variable as a HTML source code, the flow is unable to set the variable and and I do not receive an email.当我将变量设置为 HTML 源代码时,流程无法设置变量,并且我没有收到电子邮件。

The HTML Code I have used is just the source code from an email that I have sent to myself.我使用的 HTML 代码只是我发送给自己的电子邮件中的源代码。

Is there something I have overlooked?有什么我忽略了吗? I noticed that for simple html changes (ie just bolding a sentence) the flow was able to work fine and I was able to receive an email.我注意到对于简单的 html 更改(即只是将句子加粗),流程能够正常工作并且我能够收到一封电子邮件。

Guide: https://blog.sandro-pereira.com/2020/01/26/logic-apps-how-to-send-a-well-formatted-html-email-notification-with-office-365-outlook-connector/指南: https : //blog.sandro-pereira.com/2020/01/26/logic-apps-how-to-send-a-well-formatted-html-email-notification-with-office-365-outlook-连接器/

Example HTML Code:示例 HTML 代码:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
span.EmailStyle17
    {mso-style-type:personal-compose;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
.MsoChpDefault
    {mso-style-type:export-only;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
@page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
    {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>TestTESt<o:p></o:p></p></div></body></html> ```

I followed the same instructions and noticed that the primary problem is in the code (ie, most of the lines are commented), however when I attempted the same kind of approach with different HTML source code, it functioned perfectly though I was able to receive emails with the CSS styles that I applied.我按照相同的说明进行操作并注意到主要问题出在代码中(即,大部分行都被注释了),但是当我尝试使用不同的 HTML 源代码使用相同的方法时,尽管我能够接收到它,但它运行良好带有我应用的 CSS 样式的电子邮件。

Here's an example of what I'm talking about.这是我正在谈论的一个例子。

html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta  http-equiv="Content-Type"  content="text/html; charset=utf-8"  />
<title>Internal CSS</title>
<style>
body{
background-color:#9F6;
}

h1{
color:#C39;
text-align:left;
text-transform:capitalize;
text-decoration:underline;
}

P{
font-size:20px;
font-family:Verdana, Geneva, sans-serif;
background-color:#FFF;
color:#963;
}

h2{
color:#F03;
margin-left:10px;
}

a{
margin-left:10px;
}
a:hover{ /*---------------This is formate of Pseudo-element---------------*/
color:#009;
font-size:18px;
font-weight:700;
}
</style>
</head>

<body>
<h1>Example for Internal CSS</h1>
<p>Cascading Style Sheet is a style language that defines layout of HTML documents.CSS properties such as background, border, font, float, display, margin, opacity, padding, text-align, vertical-align, position, color etc.</p>
</body>
</html>

Here is the screenshot of my received mail这是我收到的邮件截图在此处输入图片说明

Modifying the HTML code just within your variable and trying again should probably resolve the issue.修改变量中的 HTML 代码并重试应该可以解决问题。

REFERENCES:参考:

https://www.programming9.com/programs/html-codes/291-internal-style-sheet-with-an-example https://www.programming9.com/programs/html-codes/291-internal-style-sheet-with-an-example

I realised what the problem was on my end.我意识到我的问题是什么。 I didn't realise that there was a character limit for variables.我没有意识到变量有字符限制。

Changing the Logic App from a Stateless to Stateful Workflow fixed the issue.将逻辑应用程序从无状态工作流更改为有状态工作流解决了该问题。

More Info: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-limits-and-config?tabs=azure-portal更多信息: https : //docs.microsoft.com/en-us/azure/logic-apps/logic-apps-limits-and-config?tabs=azure-portal

Character Limit Table For Reference字符限制表供参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM