Need help with the "Contact us form" Settings

Discussion in 'Email' started by centralcredit, Aug 26, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. previously had my website with godaddy and the contact form worked well, but when moving the page with discountasp not find a way to make it work.

    Please help!!!!!

    this is my web config.

    <system.net>
    <mailSettings>
    <smtp>
    <network host="smtp.justputit.com" port="25" userName="[email protected]" password="********" defaultCredentials="true" />
    /&gt;
    </smtp>
    </mailSettings>
    </system.net>

    This is the contact us behind code

    using System;
    using System.Net.Mail;

    public partial class _Emailer : System.Web.UI.Page
    {
    protected void Page_Load(object sender, System.EventArgs e)
    {
    if (IsPostBack)
    {
    try
    {

    string output = "";

    MailMessage mail = new MailMessage();

    // Replace with your own host address
    string hostAddress = "smtp.justputit.com";

    // Replaces newlines with br
    string message = Request.Form["c_Message"].ToString();
    message = message.Replace(Environment.NewLine, "<br />");

    output = "<p>Name: " + Request.Form["c_Name"].ToString() + ".</p>";
    output += "<p>E-amil: " + Request.Form["c_Email"].ToString() + ".</p>";
    output += "<p>Subject: " + Request.Form["c_Subject"].ToString() + ".</p>";
    output += "<p>Message: " + message + ".</p>";

    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]");
    mail.Subject = "New e-mail.";
    mail.Body = output;

    mail.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient(hostAddress);
    smtp.Send(mail);

    lblOutcome.Text = "E-mail sent successfully. Click Home to continue";
    }

    catch (Exception err)
    {
    lblOutcome.Text = "There was an exception whilst sending the e-mail: " + err.ToString() + ".";
    }
    }
    }
    protected void TopMenuRepeater_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
    {

    }
    }
     
  2. mjp

    mjp

    What happens? What kind of errors are you seeing?
     
  3. Thank you!!!

    The error is the following.

    There was an exception whilst sending the e-mail: System.Configuration.ConfigurationErrorsException: The configuration section cannot contain a CDATA or text element. (E:\web\justputitco\htdocs\web.config line 111) at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Web.HttpContext.GetSection(String sectionName) at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName) at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) at System.Net.Configuration.SmtpSectionInternal.GetSection() at System.Net.Mail.SmtpClient.get_MailConfiguration() at System.Net.Mail.MailMessage..ctor() at _Emailer.Page_Load(Object sender, EventArgs e) in e:\web\justputitco\htdocs\contact-form.aspx.cs:line 15.
     
  4. There appears to be a spurious /&gt; in the <smtp> section of your web.config. Try removing it.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page