+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Change Form submission reply-to email address

Change Form submission reply-to email address

3 posts, 0 answered
  1. Scott Farmer
    Scott Farmer avatar
    9 posts
    Registered:
    23 Mar 2010
    23 Apr 2015
    Link to this post

    Is there a way to change the "reply-to" address on the email notification from the forms module to default to the person's email address that is completing the contact form?  Currently it defaults to the provider email address.  It would be better for the staff who receives the email to be able to just reply to the customer directly from the email that is sent to their inbox.

     

    Thanks

  2. Smort
    Smort avatar
    1 posts
    Registered:
    08 Feb 2012
    03 Sep 2015
    Link to this post
    I would be interested in this as well. Our form notifications are usually sent to our support team, and it would be better for them to click "Reply" and have the form-submitter's email address automatically entered into the To: field. Is there a way to do this?
  3. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    09 Dec 2016
    08 Sep 2015
    Link to this post
    Hi,

    There is no way to change the reply-to email address as it is using the email entered as the DefaultSenderEmailAddress in the notifications settings.

    There is a way to achieve your desired behavior of having the user's email in the notifications. You can do this by creating a custom form widget. To simplify your work you can use Thunder visual studio extension to create the form widget for you.

    The best approach would be to have a HiddenField in the template and set its value to the current user's email (if such exists) on the InitializeControls method.

    Template:
    <%@ Control %>
    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" %>
     
    <asp:HiddenField  ID="EmailTextBox" runat="server" />

    InitializeControls:

    public override object Value
    {
        get
        {
            return this.EmailTextBox.Value;
        }
     
        set
        {
            this.EmailTextBox.Value = value.ToString();
        }
    }
     
    protected virtual HiddenField EmailTextBox
    {
        get
        {
            return this.Container.GetControl<HiddenField>("EmailTextBox", true);
        }
    }
     
    protected override void InitializeControls(GenericContainer container)
    {
        this.EmailTextBox.Value = GetCurrentSitefinityUserEmail();
    }
     
    private static string GetCurrentSitefinityUserEmail()
    {
        ProfileView pv = new ProfileView();
        Guid currentUserGuid = pv.CurrentUser.UserId;
     
        if (currentUserGuid != Guid.Empty)
        {
            var user = UserManager.GetManager().GetUser(currentUserGuid);
            if (user != null)
            {
                return user.Email;
            }
        }
     
        return String.Empty;
    }

    When the value of the field is an email address it is automatically formatted as a mailto link in the notifications thus allowing for easy replies.

    Furthermore you can follow the following blog post to customize the notifications' template if necessary.

    I am also attaching a complete sample of the custom form widget for reference.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
3 posts, 0 answered