smtp error: unable to connect to remote server...No connection could be made because the target mach

Discussion in 'ASP .Net' started by Homer, Aug 11, 2007.

  1. Homer

    Homer Guest

    Hi,

    I got "InnerException: Unable to connect to remote server"..."No
    connection could be made because the target machine actively refused
    it" when I attempted to send an email through my Intranet app that is
    written in asp.net 2.0. The smtp server is a local server and it uses
    Port 25. The Authentication is set to Anonymous Access. Here's my
    code:

    <system.net>
    <mailSettings>
    <smtp>
    <network host="10.162.22.72" />
    </smtp>
    </mailSettings>
    </system.net>

    Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles SendEmail.Click
    Const ToAddress As String = ""
    Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
    mm.Subject = Subject.Text
    mm.Body = Body.Text
    mm.IsBodyHtml = False
    Dim smtp As New SmtpClient
    smtp.Send(mm)
    End Sub

    In the <network host.. /> section, I did not specify a username and
    password because I set the smtp server authentication mode is set to
    Anonymous Access. Can someone please tell me what I did wrong? I
    couldn't find anything on the Web that could point me in the right
    direction.

    Thanks,
    Jon
     
    Homer, Aug 11, 2007
    #1
    1. Advertisements

  2. Homer

    Guest Guest

    Hello,

    First of all let's check if it's a problem of server/client configuration,
    or if it's .net code problem.

    Try to send an e-mail using the command line:


    http://blog.avanadeadvisor.com/blogs/braulio_malaga/archive/2007/02/26/876.aspx

    Now, check if there are some security restrictions (E.g., authentication,
    or some times the "from" must have some well know domain name). Check as well
    if you SMTP server accepts calls from client computers (some time is just
    configured to work locally, it doesn't accept petitions from other computers
    to avoid spam).

    A good support material:

    .net fx 2.0
    http://www.systemnetmail.com/

    .net fx 1.1
    http://www.systemwebmail.com/

    Good luck
    Braulio

    /// ------------------------------
    /// Braulio Diez
    ///
    /// http://www.tipsdotnet.com
    /// ------------------------------
     
    Guest, Aug 11, 2007
    #2
    1. Advertisements

  3. Homer

    Homer Guest

    Hi Braulio

    I confirmed that the SMTP server does not have any access restriction.

    In the Access tab:
    Authentication: Anonymous Access
    Connection: All except the list below. There's nothing in the list.
    Relay Restriction: Only the list below. In the list below, I granted
    access to my development PC using its IP address. I also granted
    access to 127.0.0.1 as well as checking the "Allow all computers which
    successfully authenticate to relay, regardless of the list above.

    In the Security tab:
    Grant operating permission to these windows user accounts:
    Administrator, NT AUTHORITY\LOCAL SERVICE, NT AUTHORITY\NETWORK
    SERVICE.

    How do I this?
    ....Check as well
    Thanks,
    Jonathan
     
    Homer, Aug 13, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.