Sending Email From Page

J

John

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("(e-mail address removed)",
"(e-mail address removed)")

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
 
A

Aidy

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

Alexey Smirnov

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("(e-mail address removed)",
"(e-mail address removed)")

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
 
J

John

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
 
S

sloan

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

bruce barker

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)
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 said:
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.
 
J

John

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

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("(e-mail address removed)",
"(e-mail address removed)")

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
 
J

John

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top