3

I set up my hMailServer on my windows 2008 machine, and I'm trying to send emails.

When I do it with C#

MailMessage message = new MailMessage(); message.From = new MailAddress(from, "John"); message.To.Add(new MailAddress(to)); message.Subject = subject; message.Body = body; SmtpClient client = new SmtpClient("mail.example.com"); client.Credentials = new System.Net.NetworkCredential("[email protected]", "password"); client.Send(message); 

But when I try to send emails with a windows live email client, it gives me an error

The connection to the server has failed

All the settings are exactly the same. I tried several email clients, but it doesn't work. It never happened to me before. I just moved from one machine to another, and got this problem.

I can receive mail in the client though...

3
  • 2
    You also might want to try asking this on serverfault.com Commented Apr 7, 2010 at 16:35
  • 2
    Can you try the Windows Live client from the server? Have you tried to telnet from your desktop to port 25? Commented Apr 7, 2010 at 16:38
  • Yes, it works on the server. Telnetin' right now... Commented Apr 7, 2010 at 16:48

1 Answer 1

3

Try to telnet to port 25, can it connect?

Open up command prompt:

telnet mail.example.com 25

If it cannot connect (which is what I expect) then you have a problem that is not code related but firewall related. (Or perhaps you're trying to connect to the wrong port if they're running SMTP on a non standard port)

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah, I was able to send it from server's client. I'm installing telnet right now...
You are right. Connect failed. But even after turning off my anti virus and firewall, it still can't connect.
@Alex: From here you should post on serverfault.com, but you can see that it's not code related though.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.