Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6152369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:54:30+00:00 2026-05-23T19:54:30+00:00

Here is my web.config <system.net> <mailSettings> <smtp from=myemail> <network host=ispsmtpaddress port=25 userName=user password=pass defaultCredentials=true

  • 0

Here is my web.config

<system.net>
 <mailSettings>
   <smtp from="myemail">
    <network host="ispsmtpaddress" port="25" userName="user" password="pass"    defaultCredentials="true" />
    </smtp>
  </mailSettings>
</system.net>

this is below the system.web closing tag

Here is my controller;

[AcceptVerbs(HttpVerbs.Get)]
      public ViewResult ContactUs()
       {
          return View();
        }

      [AcceptVerbs(HttpVerbs.Post)]
       public ViewResult ContactUs(ContactMessage message)
        {
           string successMessage = "Your message was sent successfully.";

        try
        {
            MailMessage email = new MailMessage()
            {
                Subject = "Email from EmailForm",
                Body = message.MessageBody,
                IsBodyHtml = false,
                From = new MailAddress(message.Email, message.Name)


            };

            email.To.Add(new MailAddress("daniel@mailtosendto.com", "Name Of My Project"));

            SmtpClient server = new SmtpClient();

            server.Send(email);
        }
        catch (Exception ex)
        {
            successMessage = ex.Message;
        }

        ViewData["SuccessMessage"] = successMessage;
        return View();
    }

here is my model;

  namespace NewAtAClick.Models
{
    public class ContactMessage
   {
    public string Name { get; set; }
    public string Email { get; set; }
    public string MessageBody { get; set; }
}

}

And my view

  @using (Html.BeginForm())
   {
    <div>
      <p>@ViewData["SuccessMessage"]</p>
    Name
    <div>
         @Html.TextBox("Name", String.Empty, new { @class = "cls-text-input" })
    </div>
    Email
    <div>
        @Html.TextBox("Email", String.Empty, new { @class = "cls-text-input" })
    </div>
    Message
    <div>
         @Html.TextArea("MessageBody")
    </div>
    <div>
        <input type="submit" value="Submit Message" />
    </div>
</div>

This is the error I’m getting on screen

‘The smtp host is not specified”. I have included my ISP’s smtp address in the web.config. I have tried a few different configurations but it won’t work. I’m developing on my local machine so I’ve alse tried locaLhost with no user and pass but nothing. Any help would be greatly appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:54:31+00:00Added an answer on May 23, 2026 at 7:54 pm

    You should set the defaultcredentials in the web.config to false to use user supplied credentials.

    Also set the deliveryMethod on SMTP to network

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to change SMTP host value on web.config transform. Here is what I
Here is the web.config; <?xml version=1.0 encoding=UTF-8?> <configuration> <system.web> <customErrors mode=Off> </customErrors> <authentication mode=Forms>
In my ASP.NET web.config, I have this: <urlCompression doDynamicCompression=true /> I went here to
Here is part of my web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:application-config.xml </param-value> </context-param> application-config.xml uses
We are using Scott Hansleman's suggestion for multiple web.configs from his post here .
I have in here an old web application written in ASP.Net 2.0 + AJAX.
I'm in the process of upgrading my web pages from asp classic to asp.net.
I am using ASP.NET Web forms and sending an automated email through our SMTP
I have modified my web.config file in my asp.net web application so that I
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.