tags:

views:

261

answers:

3

I have a very simple .net application for testing SMTP on .net. But i am receiving this weird error. "System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it"

SMTP server is remote and doesn't need any kind of authentication so i don't need credentials. But i can send mails from this computer with outlook using same smtp server and same smtp settings without any problem.

Any ideas? It will be appreciated so much.

Imports System.Net.Mail 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim smtp As New SmtpClient
    smtp.Host = "10.241.128.220"
    smtp.Port = 25
    smtp.Send("[email protected]", "[email protected]", "test", "test")
End Sub
+2  A: 
David Stratton
I am going to look for a solution with a system administrator then. But my question is how i can send with outlook and can't send with this app. This SMTP server doesn't need any kind of authentication so i don't need credentials.
Fatih
David, I think you meant to say MAPI rather than IMAP.
ho1
@ho. You're right. I fixed it, thank you.
David Stratton
A: 
  1. Outlook might not be using SMTP to send emails
  2. Are you sure Outlook is not connecting using SSL?
Pawel Lesnikowski
I am sure is not connecting using ssl.I sent a link with my outlook express settings. - http://yfrog.com/3moutlooksettingsj - http://yfrog.com/f3outlooksettings2j
Fatih
+1  A: 

I discovered the problem. It was because of McAfee Antivirus. It blocked 25 port. I disabled it and problem has been solved. Thanks to everybody. Especially David.

Fatih