Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms Ektron表单-生成明文电子邮件_Forms_Email_Plaintext_Ektron - Fatal编程技术网

Forms Ektron表单-生成明文电子邮件

Forms Ektron表单-生成明文电子邮件,forms,email,plaintext,ektron,Forms,Email,Plaintext,Ektron,在Ektron中,我有一个表单,在提交时生成HTML电子邮件并将其发送到邮箱(foo@bar.com). 应用程序(MailReader)检查该邮箱,读取邮件,去除所有标记,并保存生成的邮件以供以后使用。这是一个问题,因为HTML电子邮件中的所有文本最终都被混合在一起,使用MailReader应用程序的人完全无法读取 例如,此HTML: <h1>Header1</h1> <div> <h2>Header2</h2> <

在Ektron中,我有一个表单,在提交时生成HTML电子邮件并将其发送到邮箱(foo@bar.com). 应用程序(MailReader)检查该邮箱,读取邮件,去除所有标记,并保存生成的邮件以供以后使用。这是一个问题,因为HTML电子邮件中的所有文本最终都被混合在一起,使用MailReader应用程序的人完全无法读取

例如,此HTML:

<h1>Header1</h1>
<div>
   <h2>Header2</h2>
   <p>Some text in a paragraph.</p>
</div>
我无法以任何方式更改MailReader,它将始终删除任何标记,因此我的解决方案是让Ektron生成一封不包含此表单HTML的电子邮件。我知道电子邮件是使用XSLT转换生成的,转换文件为/Workarea/controls/forms/DefaultFormEmailBody.XSLT

我尝试的解决方案是在表单中添加一个名为“\uuunohtml”的隐藏输入。然后XSLT将执行以下操作:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:choose>
        <xsl:when test="/field[starts-with(@name, '__nohtml')]">
            <xsl:output method="text" />
        </xsl:when>
        <xsl:otherwise>
            <xsl:output method="html" />
        </xsl:otherwise>
    </xsl:choose>
    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="/field[starts-with(@name, '__nohtml')]">

                text output

            </xsl:when>
            <xsl:otherwise>

                html output

            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>

文本输出
html输出
但是当我使用它时,它从不发送电子邮件。我试着在自己的机器上用这个模板进行渲染,结果出现了错误。我还注意到xsl:output元素只允许作为顶级元素。这可能解释了为什么我不能把它放在元素中

我也尝试过完全省略元素,不管发生什么情况,它似乎都默认为HTML

我已经尝试搜索本地Ektron代码以查找转换发生的位置,这样我就可以告诉Ektron在标准情况下使用默认XSLT,或者在没有HTML的情况下使用不同的XSLT,但我不知道该代码是否可以访问


如果有人能帮我找到一个基于字段是否存在的HTML或纯文本模板,我将不胜感激。如果不是这样的话,那么如果有人能在Ektron的代码中指出XSLT转换的要点(如果可以访问的话),那将同样令人敬畏。

我建议使用一种表单策略来生成您构建的电子邮件版本。在提交后(FormData FormData、FormSubmittedData submittedFormData、string formXml、CmsEventArgs eventArgs)应有一个公共覆盖无效,允许您创建并拉出提交的表单数据(在原始对象中,或者我相信它也会返回xml。从那里你可以解析它并保存你的html文件。

我在/App_Code/CSCode/DxH/DxHFormStrategy.cs中找到了OnAfterSubmit,所以我尝试在其中添加一些日志代码。这些消息永远不会显示在我的日志中。我尝试按照指南使用该策略添加扩展名Ektron.Cms.Extensibility.Content.FormStrategy在行为上没有差异。我尝试在Ektron.Cms.Extensibility.ContentStrategy中使用相同的日志代码,但日志记录良好。不确定FormStrategy为什么不起作用。我似乎找不到任何有关FormStrategy的文档。我通过添加外接程序使FormStrategy扩展正常工作g在/objectFactory.config:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:choose>
        <xsl:when test="/field[starts-with(@name, '__nohtml')]">
            <xsl:output method="text" />
        </xsl:when>
        <xsl:otherwise>
            <xsl:output method="html" />
        </xsl:otherwise>
    </xsl:choose>
    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="/field[starts-with(@name, '__nohtml')]">

                text output

            </xsl:when>
            <xsl:otherwise>

                html output

            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>