are you coding this for asp.net 1.1 or asp.net 2.0?
The syntax looks like it is for asp.net 2.0 but your web server is running in 1.1 mode.
for asp.net 1.1 the following line:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="contact-form.aspx.cs" Inherits="_Emailer" %>
should be:
<%@ Language="C#" Inherits="_Emailer" src="contact-form.aspx.cs" %>
If you have access to the web sever, just switch the .net Framework version to v2.0 and you should be good to go without having to make any modifications. If not let me know.
I rewrote your codebehind for asp.net 1.1.... I'm doing this from memory so there might be mistakes..
using System;
using System.Text;
using System.Web.Mail;
public class _Emailer : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if(IsPostBack)
{
try
{
string output = "";
MailMessage mail = new MailMessage();
string hostAddress = "aaa.bbb.ccc.ddd";
string message = Request.Form["c_Message"].ToString();
message = message.Replace(Environment.NewLine, "<br />");
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<p>Nom du Parent: {0}.</p>", Request.Form["c_Name"].ToString());
sb.AppendFormat("<p>Nom de votre enfant: {0}.</p>", Request.Form["c_Enfant"].ToString());
sb.AppendFormat("<p>Groupe: {0}.</p>", Request.Form["c_Groupe"].ToString());
sb.AppendFormat("<p>Numéro de téléphone: {0}.</p>", Request.Form["c_Tel"].ToString());
sb.AppendFormat("<p>J'aimerais être bénévole pour: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}.</p>",
Request.Form["La bibliothèque"].ToString(),
Request.Form["Aide en classe"].ToString(),
Request.Form["Aide pour les dîners pizza"].ToString(),
Request.Form["Aide aux devoirs après l’école"].ToString(),
Request.Form["Aménagement paysager (fleurs, arbustes à tailler…)"].ToString(),
Request.Form["Photo scolaire"].ToString(),
Request.Form["Accompagner les élèves lors des sorties"].ToString(),
Request.Form["Venir parler de votre métier dans une classe ou monter un atelier"].ToString()
);
sb.AppendFormat("<p>Autres: {0}.</p>", Request.Form["c_Autre"].ToString());
mail.Subject = "New e-mail.";
mail.From = "[email protected]";
mail.To = "[email protected]";
mail.Body = sb.ToString();
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = hostAddress;
SmtpMail.Send(mail);
lblOutCome.Text = "E-mail sent successfully.";
}
catch (Exception err)
{
lblOutCome.Text = "There was an exception whilst sending the e-mail: " + err.ToString() + ".";
}
}
}
}