Changing from email?

Apr 28, 2015 at 8:44 AM

I've been using mrcms for about two weeks, still getting my head around some of the features.

Is it possible to change the email contact us form so that the return or reply to email is the email the customer used rather then using the from email in the admin section?

Apr 28, 2015 at 8:48 AM
Hi Jon,

In FormPostingHandler you could easily modify the SendFormMessages method to do this. You'd want to be able to specify which field it is that you want to use in the Admin system (e.g Email field) - you'd then pick this one out and set the FromAddress (line 157) to that.

We will consider adding this back to the core if you'd like to fork and do a pull-request.

Apr 28, 2015 at 2:24 PM
Edited Apr 28, 2015 at 2:48 PM
Hi Will,

I have started with this:
        private void SendFormMessages(Webpage webpage, FormPosting formPosting, Boolean isFromSystemEmailAddress = true)

            var fromEmail = _mailSettings.SystemEmailAddress;
            if (!isFromSystemEmailAddress)
                var xyz = formPosting.FormValues.FirstOrDefault(frm => frm.Key == "fromEmail");
                if (xyz != null) fromEmail = xyz.Value;

            if (webpage.SendFormTo == null) return;

            var sendTo = webpage.SendFormTo.Split(',');
            if (sendTo.Any())
                _session.Transact(session =>
                    foreach (var email in sendTo)
                        var formMessage = ParseFormMessage(webpage.FormMessage, webpage,
                        var formTitle = ParseFormMessage(webpage.FormEmailTitle, webpage,

                        session.SaveOrUpdate(new QueuedMessage
                            Subject = formTitle,
                            Body = formMessage,
                            FromAddress = fromEmail,
                            ToAddress = email,
                            IsHtml = true

But I guess it would be nice to control this at project setting level and overload it? Was that what you were hinting at? Also I use github but finding it hard to clone back to codeplex I've not done that before

EDITED THE CODE as it was wrong