Sending Email From Page

Discussion in 'ASP .Net' started by John, Feb 15, 2007.

  1. John

    John Guest

    Hi there,

    I'm sure this is very basic for those who know..............but can anyone
    tell what I'm doing wrong?

    I'm trying out a 'send email from page' from a Wrox book and getting the
    following error:

    "No connection could be made because the target machine actively refused it
    "

    Basically I've got a textbox and a button and have place the following code
    uder the click event:

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    Dim message As New System.Net.Mail.MailMessage("",
    "")

    message.Subject = "An Email Message From the web"

    message.Body = Me.TextBox1.Text

    Dim smtp As New System.Net.Mail.SmtpClient("localhost")

    smtp.Send(message)

    End Sub

    I'm developing this in VS 2005 Pro (nb not IIS).

    Please help a beginner!

    Best regards

    John
     
    John, Feb 15, 2007
    #1
    1. Advertising

  2. John

    Aidy Guest

    You are trying to connect to the SMTP service running on your local host.
    If you don't have one running then it has nothing to connect to. Try
    connecting to your ISP's SMTP server instead.

    "John" <> wrote in message
    news:%...
    > Hi there,
    >
    > I'm sure this is very basic for those who know..............but can anyone
    > tell what I'm doing wrong?
    >
    > I'm trying out a 'send email from page' from a Wrox book and getting the
    > following error:
    >
    > "No connection could be made because the target machine actively refused
    > it "
    >
    > Basically I've got a textbox and a button and have place the following
    > code uder the click event:
    >
    > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Button1.Click
    >
    > Dim message As New System.Net.Mail.MailMessage("",
    > "")
    >
    > message.Subject = "An Email Message From the web"
    >
    > message.Body = Me.TextBox1.Text
    >
    > Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >
    > smtp.Send(message)
    >
    > End Sub
    >
    > I'm developing this in VS 2005 Pro (nb not IIS).
    >
    > Please help a beginner!
    >
    > Best regards
    >
    > John
    >
    >
     
    Aidy, Feb 15, 2007
    #2
    1. Advertising

  3. On Feb 15, 1:39 pm, "John" <> wrote:
    > Hi there,
    >
    > I'm sure this is very basic for those who know..............but can anyone
    > tell what I'm doing wrong?
    >
    > I'm trying out a 'send email from page' from a Wrox book and getting the
    > following error:
    >
    > "No connection could be made because the target machine actively refused it
    > "
    >
    > Basically I've got a textbox and a button and have place the following code
    > uder the click event:
    >
    > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Button1.Click
    >
    > Dim message As New System.Net.Mail.MailMessage("",
    > "")
    >
    > message.Subject = "An Email Message From the web"
    >
    > message.Body = Me.TextBox1.Text
    >
    > Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >
    > smtp.Send(message)
    >
    > End Sub
    >
    > I'm developing this in VS 2005 Pro (nb not IIS).
    >
    > Please help a beginner!
    >
    > Best regards
    >
    > John


    SMTP service is not started
     
    Alexey Smirnov, Feb 15, 2007
    #3
  4. John

    John Guest

    Hello Aidy and Alexey,

    Thanks for your replies. Well I've added my email smtp server details but
    I'm now getting another error, which I assume is my isp blocking outgoing
    email?

    ERROR = "Transaction failed. The server response was:
    <my.isp.server[my.isp.server.ip.address]>: Client host rejected: Access
    denied"

    Is there any way around this?

    Thanks again.

    John

    "Aidy" <> wrote in message
    news:...
    > You are trying to connect to the SMTP service running on your local host.
    > If you don't have one running then it has nothing to connect to. Try
    > connecting to your ISP's SMTP server instead.
    >
    > "John" <> wrote in message
    > news:%...
    >> Hi there,
    >>
    >> I'm sure this is very basic for those who know..............but can
    >> anyone tell what I'm doing wrong?
    >>
    >> I'm trying out a 'send email from page' from a Wrox book and getting the
    >> following error:
    >>
    >> "No connection could be made because the target machine actively refused
    >> it "
    >>
    >> Basically I've got a textbox and a button and have place the following
    >> code uder the click event:
    >>
    >> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Button1.Click
    >>
    >> Dim message As New System.Net.Mail.MailMessage("",
    >> "")
    >>
    >> message.Subject = "An Email Message From the web"
    >>
    >> message.Body = Me.TextBox1.Text
    >>
    >> Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >>
    >> smtp.Send(message)
    >>
    >> End Sub
    >>
    >> I'm developing this in VS 2005 Pro (nb not IIS).
    >>
    >> Please help a beginner!
    >>
    >> Best regards
    >>
    >> John
    >>
    >>

    >
    >
     
    John, Feb 15, 2007
    #4
  5. John

    sloan Guest

    I have several complete email samples at:

    You need to know about none, basic, ssl authentication (in addition to all
    the other email stuff you need to know)


    http://sholliday.spaces.live.com/blog/

    2/8/2006
    Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)



    "John" <> wrote in message
    news:%...
    > Hi there,
    >
    > I'm sure this is very basic for those who know..............but can anyone
    > tell what I'm doing wrong?
    >
    > I'm trying out a 'send email from page' from a Wrox book and getting the
    > following error:
    >
    > "No connection could be made because the target machine actively refused

    it
    > "
    >
    > Basically I've got a textbox and a button and have place the following

    code
    > uder the click event:
    >
    > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Button1.Click
    >
    > Dim message As New System.Net.Mail.MailMessage("",
    > "")
    >
    > message.Subject = "An Email Message From the web"
    >
    > message.Body = Me.TextBox1.Text
    >
    > Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >
    > smtp.Send(message)
    >
    > End Sub
    >
    > I'm developing this in VS 2005 Pro (nb not IIS).
    >
    > Please help a beginner!
    >
    > Best regards
    >
    > John
    >
    >
     
    sloan, Feb 15, 2007
    #5
  6. John

    bruce barker Guest

    you need to supply the proper credentials, also your isp may require
    that the from match the account name. also set ssl if required.

    -- bruce (sqlwork.com)

    John wrote:
    > Hello Aidy and Alexey,
    >
    > Thanks for your replies. Well I've added my email smtp server details but
    > I'm now getting another error, which I assume is my isp blocking outgoing
    > email?
    >
    > ERROR = "Transaction failed. The server response was:
    > <my.isp.server[my.isp.server.ip.address]>: Client host rejected: Access
    > denied"
    >
    > Is there any way around this?
    >
    > Thanks again.
    >
    > John
    >
    > "Aidy" <> wrote in message
    > news:...
    >> You are trying to connect to the SMTP service running on your local host.
    >> If you don't have one running then it has nothing to connect to. Try
    >> connecting to your ISP's SMTP server instead.
    >>
    >> "John" <> wrote in message
    >> news:%...
    >>> Hi there,
    >>>
    >>> I'm sure this is very basic for those who know..............but can
    >>> anyone tell what I'm doing wrong?
    >>>
    >>> I'm trying out a 'send email from page' from a Wrox book and getting the
    >>> following error:
    >>>
    >>> "No connection could be made because the target machine actively refused
    >>> it "
    >>>
    >>> Basically I've got a textbox and a button and have place the following
    >>> code uder the click event:
    >>>
    >>> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    >>> System.EventArgs) Handles Button1.Click
    >>>
    >>> Dim message As New System.Net.Mail.MailMessage("",
    >>> "")
    >>>
    >>> message.Subject = "An Email Message From the web"
    >>>
    >>> message.Body = Me.TextBox1.Text
    >>>
    >>> Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >>>
    >>> smtp.Send(message)
    >>>
    >>> End Sub
    >>>
    >>> I'm developing this in VS 2005 Pro (nb not IIS).
    >>>
    >>> Please help a beginner!
    >>>
    >>> Best regards
    >>>
    >>> John
    >>>
    >>>

    >>

    >
    >
     
    bruce barker, Feb 15, 2007
    #6
  7. John

    John Guest

    Thanks Bruce. I see Sloan has some examples so I might try and work through
    those as I'm fairly new to this area.

    Thanks again.

    John

    "bruce barker" <> wrote in message
    news:...
    > you need to supply the proper credentials, also your isp may require that
    > the from match the account name. also set ssl if required.
    >
    > -- bruce (sqlwork.com)
    >
    > John wrote:
    >> Hello Aidy and Alexey,
    >>
    >> Thanks for your replies. Well I've added my email smtp server details
    >> but I'm now getting another error, which I assume is my isp blocking
    >> outgoing email?
    >>
    >> ERROR = "Transaction failed. The server response was:
    >> <my.isp.server[my.isp.server.ip.address]>: Client host rejected: Access
    >> denied"
    >>
    >> Is there any way around this?
    >>
    >> Thanks again.
    >>
    >> John
    >>
    >> "Aidy" <> wrote in message
    >> news:...
    >>> You are trying to connect to the SMTP service running on your local
    >>> host. If you don't have one running then it has nothing to connect to.
    >>> Try connecting to your ISP's SMTP server instead.
    >>>
    >>> "John" <> wrote in message
    >>> news:%...
    >>>> Hi there,
    >>>>
    >>>> I'm sure this is very basic for those who know..............but can
    >>>> anyone tell what I'm doing wrong?
    >>>>
    >>>> I'm trying out a 'send email from page' from a Wrox book and getting
    >>>> the following error:
    >>>>
    >>>> "No connection could be made because the target machine actively
    >>>> refused it "
    >>>>
    >>>> Basically I've got a textbox and a button and have place the following
    >>>> code uder the click event:
    >>>>
    >>>> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    >>>> System.EventArgs) Handles Button1.Click
    >>>>
    >>>> Dim message As New System.Net.Mail.MailMessage("",
    >>>> "")
    >>>>
    >>>> message.Subject = "An Email Message From the web"
    >>>>
    >>>> message.Body = Me.TextBox1.Text
    >>>>
    >>>> Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >>>>
    >>>> smtp.Send(message)
    >>>>
    >>>> End Sub
    >>>>
    >>>> I'm developing this in VS 2005 Pro (nb not IIS).
    >>>>
    >>>> Please help a beginner!
    >>>>
    >>>> Best regards
    >>>>
    >>>> John
    >>>>
    >>>>
    >>>

    >>
     
    John, Feb 15, 2007
    #7
  8. John

    John Guest

    Hi Sloan,

    Thanks for your reply. I've had a look at your blog and will have a go with
    your example. Great blog!

    Thanks again.

    John

    "sloan" <> wrote in message
    news:%23jKbF$...
    >I have several complete email samples at:
    >
    > You need to know about none, basic, ssl authentication (in addition to all
    > the other email stuff you need to know)
    >
    >
    > http://sholliday.spaces.live.com/blog/
    >
    > 2/8/2006
    > Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)
    >
    >
    >
    > "John" <> wrote in message
    > news:%...
    >> Hi there,
    >>
    >> I'm sure this is very basic for those who know..............but can
    >> anyone
    >> tell what I'm doing wrong?
    >>
    >> I'm trying out a 'send email from page' from a Wrox book and getting the
    >> following error:
    >>
    >> "No connection could be made because the target machine actively refused

    > it
    >> "
    >>
    >> Basically I've got a textbox and a button and have place the following

    > code
    >> uder the click event:
    >>
    >> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Button1.Click
    >>
    >> Dim message As New System.Net.Mail.MailMessage("",
    >> "")
    >>
    >> message.Subject = "An Email Message From the web"
    >>
    >> message.Body = Me.TextBox1.Text
    >>
    >> Dim smtp As New System.Net.Mail.SmtpClient("localhost")
    >>
    >> smtp.Send(message)
    >>
    >> End Sub
    >>
    >> I'm developing this in VS 2005 Pro (nb not IIS).
    >>
    >> Please help a beginner!
    >>
    >> Best regards
    >>
    >> John
    >>
    >>

    >
    >
     
    John, Feb 15, 2007
    #8
    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. bivin
    Replies:
    1
    Views:
    731
    venkat
    Jun 27, 2003
  2. VB Programmer
    Replies:
    3
    Views:
    3,803
    VB Programmer
    Aug 9, 2004
  3. John

    Sending email from a web page?

    John, Oct 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    397
  4. Luke
    Replies:
    2
    Views:
    4,788
    Nigel Wade
    Mar 15, 2007
  5. rote
    Replies:
    8
    Views:
    793
Loading...

Share This Page