I've googled the below error, however most of the results are actually pages where it is happening, not pages with answers on how to fix it. I'm trying to get the default contact form to send an email before i spend time modifying it to operate as needed. Is there anything that needs to be changed for a default installation?
<div class="form-actions"> <button type="submit" class="btn btn-primary textPw">@Dictionary.Send</button> </div> @*Anti forgery key*@ @Context.GetAntiForgeryHtml() </fieldset> </form> } else { var ok = SendForm(form); if (!ok) { <div id="errorMailSettings"> @Model.ErrorMessage </div> } else { // Set Thankyou text from our contact node <div id="thankYou"> <h2>@Model.ThankYouHeaderText</h2> @Model.ThankYouMessageText </div> } } }
@functions { public bool SendForm(NameValueCollection form) { // Get the variables from the form and set them in strings string strName = Library.StripHtml(form["name"]).ToString(); string strAddressLine1 = Library.StripHtml(form["address1"]).ToString(); string strAddressLine2 = Library.StripHtml(form["address2"]).ToString(); string strEmailFrom = Library.StripHtml(form["email"]).ToString(); string strMessage = Library.StripHtml(form["enquiry"]).ToString();
// Lets set the values passed in from the Macro string strEmailTo = Model.EmailTo.ToString(); string strEmailSubject = Model.EmailSubject.ToString(); var now = DateTime.Now; var strTime = String.Format("{0:HH:mm:ss}", now); var strDate = String.Format("{0:dd/MM/yyyy}", now);
// Let's Replace the placeholders in the email message body var strEmailBody = new StringBuilder(Model.EmailBody.ToString()); strEmailBody.Replace("[Name]", strName); // Find and Replace [Name] strEmailBody.Replace("[AddressLine1]", strAddressLine1); // Find and Replace [AddressLine1] strEmailBody.Replace("[AddressLine2]", strAddressLine2); // Find and Replace [AddressLine2] strEmailBody.Replace("[Email]", strEmailFrom); // Find and Replace [Email] strEmailBody.Replace("[Message]", strMessage); // Find and Replace [Message] strEmailBody.Replace("[Time]", strTime); // Find and Replace [Time] strEmailBody.Replace("[Date]", strDate); // Find and Replace [Date]
// Now the email is sent out to the owner, lets send out an email // to let the user know we have recieved their email & will respond shortly string strEmailReplySubject = Model.EmailReplySubject.ToString(); var strEmailReplyBody = new StringBuilder(Model.EmailReplyBody.ToString()); strEmailReplyBody.Replace("[Name]", strName); // Find and Replace [Name]
What version of Umbraco are you using? Perhaps some of the Razor implementation has been changed a bit since the above macro was created.
What do you get in the trace log if you add ?umbdebugshowtrace=1 to the url where you use the macro?
Once we have this form working you should also make sure that the smtp settings in your web.config file has been configured properly otherwise you will not receive any e-mail.
Ok I'm very new to using Umbraco. We are on version 4.11.1. I added the showtrace part to the url but i didn't get any trace results. Below are screen shots of the form and after pressing submit.
Hmm, try checking if the umbdebug has been disabled by checking the "umbdebug" key in the web.config file - I believe you should be able to see something in the stack trace so just want to make sure it's not disabled.
And be aware that "umdebug" is from the top of my mind. Look in the ad keys section and look for something that contains "debug" at least and if it's set to false set it to true.
It was set to false, so I changed it to true. however I still don't get a stack trace or any usable error message when testing the contact form. just a bunch of blue outlined boxes.
yup, now i see the info down there. what should i be looking for in it? the error appears after i submit the form, but the trace disappears after submit.
Default Contact Form error
I've googled the below error, however most of the results are actually pages where it is happening, not pages with answers on how to fix it. I'm trying to get the default contact form to send an email before i spend time modifying it to operate as needed. Is there anything that needs to be changed for a default installation?
Error loading MacroEngine script (file: ContactForm.cshtml)
Below is ContactForm.cshtml
Hi Matt and welcome to our :)
What version of Umbraco are you using? Perhaps some of the Razor implementation has been changed a bit since the above macro was created.
What do you get in the trace log if you add ?umbdebugshowtrace=1 to the url where you use the macro?
Once we have this form working you should also make sure that the smtp settings in your web.config file has been configured properly otherwise you will not receive any e-mail.
Looking forward to hearing from you.
/Jan
Ok I'm very new to using Umbraco. We are on version 4.11.1. I added the showtrace part to the url but i didn't get any trace results. Below are screen shots of the form and after pressing submit.
Hi Matt
Hmm, try checking if the umbdebug has been disabled by checking the "umbdebug" key in the web.config file - I believe you should be able to see something in the stack trace so just want to make sure it's not disabled.
And be aware that "umdebug" is from the top of my mind. Look in the ad keys section and look for something that contains "debug" at least and if it's set to false set it to true.
Hope this makes sense (A bit hungover today).
/Jan
It was set to false, so I changed it to true. however I still don't get a stack trace or any usable error message when testing the contact form. just a bunch of blue outlined boxes.
Hi Matt
Sorry for the late reply.
Don't you have an option to scroll further down where the actual trace should appear?
/Jan
yup, now i see the info down there. what should i be looking for in it? the error appears after i submit the form, but the trace disappears after submit.
is working on a reply...