Cannot connect to remote mail server for sending emails in ASP.NET
Posted
by Dave
on Server Fault
See other posts from Server Fault
or by Dave
Published on 2010-05-13T00:31:19Z
Indexed on
2010/05/14
13:25 UTC
Read the original article
Hit count: 317
I want to migrate a web application from a Windows Server 2003 to a Windows Server 2008 R2. All works fine except sending emails from the application.
If I configure the application to use the smtp server on "localhost" it works, but changing it to the "real" host name (e.g. mail.example.org) no mail is sent. The error message says, that the remote server needs a secure connection or smtp authentication. But since it works when using "localhost" instead of the host name I doubt that this is the problem.
Also it's unlikely a problem with the mail server, I also tried it with another one.
So for me it seems like the firewall is blocking the outgoing connection to the mail server. I tried to open port 25, but it still did not work. Maybe I just did it the wrong way.
Update: For clarifying my setup:
- I have a Windows Server 2008 R2 with hMailServer installed (set up for some of the hosted domains)
- For the website I'm talking about I need to use an external mail server (totally different hosting provider)
Apparently I was a bit off the track. It seems like it works when using connecting to the local mail server either with the host name "localhost" or "mail.somedomain.com" (while somedomain.com is set up in my mail server). But when using the host name of the external mail server ("mail.externaldomain.com") it seems like it tries to connect to the local server again, although this domain is not set up in the mail server. Thanks to Evan Anderson for the tip to use telnet - why I have not thought of it myself?... :-)
Note, the website www.externaldomain.com is hosted on my server but the DNS entries are maintained by the other hosting provider. "externaldomain.com" is the only entry which points to my server all other records (MX, subdomains) are pointing to the other server.
So I think the question is now, how do i bring my server to connect to the external mailserver. Do I have to configure this in my mail server or is it a windows server thing?
© Server Fault or respective owner