machine actively refused

Discussion in 'ASP.NET / ASP.NET Core' started by seal, Apr 21, 2012.

  1. I am trying to run this scipt, and I am getting this message:
    No connection could be made because the target machine actively refused it 127.0.0.1:25
    If this has to do with firewalls, how to get to them?
    I have tried to disable them (Windows and Nortons), and it stil happens.

    <%@ Import Namespace="System.Net.Mail" %>
    <script language="C#" runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    //create the mail message
    MailMessage mail = new MailMessage();
    //set the addresses
    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]");
    //set the content
    mail.Subject = "This is an email from script";
    mail.Body = "this is the body content of the email script.";
    //send the message
    SmtpClient smtp = new SmtpClient("localhost");
    smtp.Send(mail);
    lblMessage.Text = "Mail Sent";
    }
    </script>
    <html>
    <body>
    <form id="Form1" runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
    </form>
    </body>
    </html>
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    where are you running this code? on your computer or our server?
     

Share This Page