How we can send email with attached file, while clicking form submit button?

We are currently using Sitecore 9 Update 2 with SXA 1.7.2.

2 Answers 2


As an alternative, you can create a custom action "send email" based on: Send-E-mail-Action-to-Sitecore-9-Forms, add to action's editor dialog/view model link to media item. And when on action executing add to mail attachments linked media item.


There is no functionality like that in your version of Sitecore, neither it is in latest Sitecore 9.1.

You have two options:

  1. Create your custom Field Type "FileUpload" inspiring by official documentation by Sitecore -> https://doc.sitecore.com/developers/91/sitecore-experience-management/en/walkthrough--creating-a-custom-rating-element-with-property-editor.html .
  2. Use code from Sitecore Forms Extensions github repository https://github.com/bartverdonck/Sitecore-Forms-Extensions and specifically this part -> https://github.com/bartverdonck/Sitecore-Forms-Extensions/tree/master/src/Feature/FormsExtensions/code/Fields/FileUpload.

    It should have really simple model:

    using System;
    using System.Globalization;
    using System.Web;
    using Feature.FormsExtensions.Business.FileUpload;
    using Sitecore;
    using Sitecore.Data.Items;
    using Sitecore.ExperienceForms.Mvc.Models.Validation;
    namespace Feature.FormsExtensions.Fields.FileUpload
        public class FileUploadModel : ValueNotValidatedInputViewModel<IStoredFile>
            private HttpPostedFileBase file;
            private const string AllowedContentTypesParam = "Allowed Content Types";
            private const string MaxFileSizeParam = "Max File Size";
            public virtual HttpPostedFileBase File
                get => file;
                set => file = value;
            public string AllowedContentTypes { get; set; }
            public int MaxFileSize { get; set; }
            protected override void InitItemProperties(Item item)
               AllowedContentTypes = StringUtil.GetString(item.Fields[AllowedContentTypesParam]);
               MaxFileSize = MainUtil.GetInt(item.Fields[MaxFileSizeParam]?.Value, 0);
            protected override void UpdateItemFields(Item item)
                item.Fields[AllowedContentTypesParam]?.SetValue(AllowedContentTypes, true); 
  • While submitting the submit button, i'm getting null value for the File
    – PKH
    Commented Jan 17, 2019 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.