i recieved this error : "No connection could be made because the target machine actively re

i recieved this error while trying to send email "No connection could be made because the target machine actively refused it" and thats the code i wrote :

privatevoid button1_Click(object sender,EventArgs e)

{

System.Net.Mail.MailMessage message =new System.Net.Mail.MailMessage();

message.To.Add("mnos7y@hotmail.com");

message.CC.Add("mnos7y@hotmail.com");

message.From =new System.Net.Mail.MailAddress("mnos7y@hotmail.com");

message.Body ="some text";

System.Net.Mail.SmtpClient smtp =new System.Net.Mail.SmtpClient("localhost", 25);

smtp.Credentials =newNetworkCredential("mnos7y@hotmail.com","password");

smtp.Send(message);

}

[2087 byte] By [noshy] at [2007-12-28]
# 1

It looks to me like the SMTP server running on your local host is not configured to allow unauthenticated users to send email to non-local domains. My instinct says that if you set the user id and the password in NetworkCredentials to your machine credentials, it woudl get through.

Assuming that your SMTP server is configured correctly and running. It is doing that, right?

BJohnson at 2007-9-4 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
Right
noshy at 2007-9-4 > top of Msdn Tech,Visual C#,Visual C# General...