Unable to connect to the remote server

Discussion in 'Email' started by jays, Dec 6, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi There,
    I am having an issue where, while trying to send an email, it returns this error. I am using these settings for the code, please let me know what else I could try.

    This is the C# code that I got from DiscountASP.NET tech support.

    Thanks
    Jay

    Code block:
    SmtpClient smtpClient = new SmtpClient();
    smtpClient.Host = "localhost";
    smtpClient.UseDefaultCredentials = true;
    MailMessage mailmessage = new MailMessage(email.FromAddress, email.ToAddress);
    mailmessage.IsBodyHtml = email.IsHtmlBody;
    mailmessage.Subject = email.Subject;
    mailmessage.Body = email.MessageBody;
    mailmessage.BodyEncoding = Encoding.Default;
    mailmessage.Priority = MailPriority.High;

    smtpClient.Send(mailmessage);




    Exception Details:

    {"Unable to connect to the remote server"}
    [System.Net.WebException]: {"Unable to connect to the remote server"}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: {"No connection could be made because the target machine actively refused it 127.0.0.1:25"}
    Message: "Unable to connect to the remote server"
    Source: "System"
    StackTrace: " at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)\r\n at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)\r\n at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)\r\n at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)\r\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\r\n at System.Net.Mail.SmtpClient.Send(MailMessage message)"
    TargetSite: {System.Net.Sockets.Socket GetConnection(System.Net.PooledStream, System.Object, Boolean, System.Net.IPAddress ByRef, System.Net.Sockets.Socket ByRef, System.Net.Sockets.Socket ByRef, Int32)}
    >
     
  2. I should also mention this is a Silverlight based web application. For host I have tried smtp.gisassist.com as well as localhost.

    Thanks
    Jay
     
  3. I need to resolve this issues as soon as possible, can somebody help me out here.

    Thanks
    Jay
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    this error means that the silverlight app cannot access the mail server. I suspect the code is actually executing on the client side and you virtually have no control on whether the client has port 25 access.
     
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