@{
    Layout = "~/_SiteLayout.cshtml";

    var customerName = Request["customerName"];
    var customerEmail = Request["customerEmail"]; 
    var customerRequest = Request["customerRequest"];
    var subjectLine = Request["subjectLine"];
    var message = Request["message"];
    var fileAttachment = Request["fileAttachment"];
    var with = "with";
    var errorMessage = "";

    // use a try catch block and send the email
    try {
        // Initialize WebMail helper
        WebMail.SmtpServer = "your-smtp-server";
        WebMail.SmtpPort = 25;
        WebMail.UserName = "your-username";
        WebMail.Password = "password";
        WebMail.From = "your-email-address";
        WebMail.EnableSsl = true;

        // Create array containing file name
        var filesList = new string [] { fileAttachment };

        // Attach file and send email
        if(fileAttachment == null || fileAttachment.IsEmpty()) {
            WebMail.Send(to: customerEmail,
            subject: subjectLine,
            body: "From: " + customerName + "\n\nHis message: " + message);
            with = "without";
        } else {
            WebMail.Send(to: customerEmail,
            subject: subjectLine,
            body: "From: " + customerName + "\n\nHis message: " + message,
            filesToAttach: filesList);
        }
    }
    catch (Exception ex ) {
        errorMessage = ex.Message;
    }
}
<!DOCTYPE html>
<html>
<head>
    <title>Request for Assistance</title>
</head>
<body>
  <p>Sorry to hear that you are having trouble, <b>@customerName</b>.</p>
    @if(errorMessage == "")
    {
        <p><b>@customerName</b>, thank you for your interest.</p>
        <p>An email message has been sent to our customer service
           department <b>@with</b> the <b>@fileAttachment</b> file attached.</p>
    }
    else
    {
        <p><b>The email was <em>not</em> sent.</b></p>
        <p>Please check that the code in the ProcessRequest page has 
           correct settings for the SMTP server name, a user name, 
           a password, and a "from" address.
        </p>
        <p>The following error was reported:</p>
        <p><em>@errorMessage</em></p>
    }
</body>
</html>