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. Advertising

  2. RE: smtp error: unable to connect to remote server...No connection cou

    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
    /// ------------------------------




    "Homer" wrote:

    > 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
    >
    >
     
    =?Utf-8?B?QnJhdWxpbyBEaWV6?=, Aug 11, 2007
    #2
    1. Advertising

  3. Homer

    Homer Guest

    Re: smtp error: unable to connect to remote server...No connection cou

    On Aug 11, 4:26 am, Braulio Diez <> wrote:
    > 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/2...
    >
    > 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.0http://www.systemnetmail.com/
    >
    > .net fx 1.1http://www.systemwebmail.com/
    >
    > Good luck
    > Braulio
    >
    > /// ------------------------------
    > /// Braulio Diez
    > ///
    > ///http://www.tipsdotnet.com
    > /// ------------------------------
    >
    >
    >
    > "Homer" wrote:
    > > 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- Hide quoted text -

    >
    > - Show quoted text -


    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
    > 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).


    Thanks,
    Jonathan
     
    Homer, Aug 13, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gaurav tyagi
    Replies:
    0
    Views:
    5,025
    gaurav tyagi
    Mar 18, 2006
  2. Replies:
    3
    Views:
    40,313
    Roedy Green
    Nov 16, 2005
  3. Replies:
    9
    Views:
    62,076
    ytterbius
    May 10, 2007
  4. Christina
    Replies:
    3
    Views:
    227
    Consultant
    May 22, 2006
  5. Replies:
    8
    Views:
    238
    Swanagon, John M \(John\)
    Jul 25, 2006
Loading...

Share This Page