2015-02-10 24 views
2

我在umbraco 7.2中使用了新的表單功能,並設置了一些表單,所有工作。我可以在後臺看到入口。Umbraco 7.2表單(不是輪廓) - 自定義電子郵件工作流程

我現在想要做的是建立一個工作流程,當表單被提交時發送一封電子郵件,但是我想發送郵件中表單的內容,但我不想發送所有這些在電子郵件中只有一些字段。

任何想法如何做到這一點?

+1

你弄清楚如何做到這一點?我也對此感興趣。 – howlee 2015-02-19 10:09:26

+0

@howlee是的我做過了,你必須選擇發送電子郵件使用XSLT轉換,然後選擇一個XSLT文件,將創建HTML電子郵件 – 2015-02-19 14:09:04

回答

1

新窗體中的工作流程顯然與舊版本中的工作流程完全相同。您可以使用像這樣創建自己的自定義工作流:

using System; 
using System.Collections.Generic; 
using System.IO; 
using System.Text.RegularExpressions; 
using System.Web; 
using System.Xml; 
using Umbraco.Forms.Core; 
using Umbraco.Forms.Core.Attributes; 
using Umbraco.Forms.Core.Enums; 
using Umbraco.Forms.Data.Storage; 

namespace WebApp.Contour 
{ 
    public class SendEmailToUser : WorkflowType 
    { 
     // Generates the new workflow details for Contour in the workflow dropdown in Contour 
     public SendEmailToUser() 
     { 
      // Need to generate a new guid for the new custom workflow - add your own GUID 
      this.Id = new Guid("PLACE GUID HERE"); 
      this.Name = "PUT WORKFLOW NAME HERE"; 
      this.Description = "PUT WORKFLOW DESCRIPTION HERE"; 
    } 

    public override List<Exception> ValidateSettings() 
    { 
     List<Exception> exceptions = new List<Exception>(); 

     //if you have any settings, validate them here 

     return exceptions; 
    } 

    public override Umbraco.Forms.Core.Enums.WorkflowExecutionStatus Execute(Record record, RecordEventArgs e) 
    { 
     //place your workflow execution logic here, "record" gives you access to the fields on the submitted record    

     return WorkflowExecutionStatus.Completed; 
    } 
} 

有關如何編寫工作流的更多細節,看看在這個教程中的例子:creating a quiz in Contour

+0

我認爲OP是指7.2新的umbraco形式引擎部分(即 - 他是不使用輪廓)。我也會對這個問題的答案感興趣。 – howlee 2015-02-19 10:09:03

+1

根據維護Contour/Umbraco Forms的人Tim Geysens的說法,他們對Workflows使用相同的引擎,所以這個代碼應該適用於兩者。 – Tim 2015-02-19 11:07:05

相關問題