Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rn4j0r 15 posts 85 karma points
    Jun 01, 2015 @ 19:52
    rn4j0r
    0

    Error loading MacroEngine script (file: EmailForm.cshtml)

    I have this Contact form in the footerish area of a website


    Getting error: 
    Error loading MacroEngine script (file: EmailForm.cshtml)

    EmailForm.cshtml =


    @inherits umbraco.MacroEngines.DynamicNodeContext

     

    @using System.Web.Mvc.Html

    @using ClientDependency.Core.Mvc

    @using Umbraco.Web

    @using Umbraco.Web.Models

    @using Umbraco.Web.Controllers

    @using System.Net.Mail

    @if (IsPost) {

    @* Detect Spam*@

    if(Request["cc"] != "" || Request["comments"] != ""){

    <h3>Spam detected</h3>

    }else {

       MailMessage mail = new MailMessage();

    mail.From = new MailAddress("[email protected]");

    mail.To.Add("[email protected]");

    mail.Subject = Request["name"];

    mail.IsBodyHtml = true;

    @*Create mail body ... take all input names and input values*@

    foreach(string name in Request.Form){

    if(Request.Form[name] != Request.Form["cc"] || Request.Form[name] != Request.Form["comments"]){

    mail.Body += @name.Replace("_", " ") + ":&nbsp;&nbsp;&nbsp;" + Request.Form[name] + "<br/>"; 

    }else{}

    }

    mail.ReplyToList.Add(new MailAddress (Request["email"]));

    @*SMTP start*@

    SmtpClient smtp = new SmtpClient();

    try

    {

    smtp.Send(mail);

    }

    catch

    {

    @*do nothing*@

    }

    <span class="hideForm"></span>

    }

    }

     

    ------------------------------------------------------------------------------------------------------------------------

    Anyone see anyhting wrong in the above code that could be causing this?

    Using Umbraco 7.1.0

    Thanks

  • rn4j0r 15 posts 85 karma points
    Jun 02, 2015 @ 22:04
    rn4j0r
    0

    Bump

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies