Hello everyone,

I’m not 100% sure this is a DNS problem but from what I’ve tracked down so far it seems it could be so here goes. Also, keep in mind I am primarily a software engineer and have no formal training in network setup or administration. I have installed Windows Server 2008 on a server here at work to use as a testing and development sandbox. I have the following Roles and Role Services Installed:

DNS Server
Print Services
Application Role + Services Installed:
Application Server Foundation
Web Server (IIS) Support
COM+ Network Access
TCP Port Sharing
Windows Process Activation Service Support
HTTP Activation
Message Queuing Activation
TCP Activation
Named Pipes Activation
Distributed Transactions
Incoming Remote Transactions
Outgoing Remote Transactions

Web Server Role + Services Installed:
Web Server
Common HTTP Features
Static Content
Default Content
Directory Browsing
HTTP Errors
HTTP Redirection
Application Development
.Net Extensibility
ISAPI Extensions
ISAPI Filters
Server Side Includes
Health and Diagnostics
HTTP Logging
Logging Tools
Request Monitor
Custom Logging
ODBC Logging
Basic Authentication
Windows Authentication
Digest Authentication
Client Certificate Mapping Authentication
IIS Client Certificate Mapping Authentication
URL Authorization
Request Filtering
IP and Domain Restrictions
Static Content Compression
Dynamic Content Compression
Management Tools
IIS Management Console
IIS management Scripts and Tools
Management Service
IIS 6 Management Compatibility
IIS 6 Metabase Compatibility
IIS 6 WMI Compatibility
IIS 6 Scripting Tools
IIS 6 Management Console
FTP Publishing Service
FTP Server
FTP Management Console

I also have the following features installed on the server:
.Net Framework 3.0 Features
.NET Framework 3.0
XPS Viewer
WCF Activation
HTTP Activation
Non-HTTP Activation
Message Queuing
Message Queuing Services
Message Queuing Server
Remote Server Administration Tools
Role Administration Tools
DNS Server Tools
Print Services Tools
Web Server (IIS) Tools
Feature Administration Tools
SMTP Server Tools
SMTP Server
Windows Powershell
Windows Process Activation Service
Process Model
.NET Environment
Configuration APIs

All of which work great (to my knowledge). I use DynDNS (http://www.dyndns.com/) for my domain name because I do not have a domain purchased for this server. This setup works out great and I am able to browse the 15 asp.net and php (which I also have installed) websites I manage in IIS7 without any difficulty. The only problem comes when I try to send an email through the code of any of my asp.net pages.

I have IIS 6 also installed on my server to deal with FTP (which I don’t use and have stopped because I use SFTP with FreeSSHD) and SMTP. In IIS6, under my local computer I have only a stopped ftp site and “[SMTP Virtual Server #1]” which is started. Under the SMTP virtual Server in domains I have my server’s name which is of type “local (default)” and the drop directory within that is correct. (I know this is just for receiving emails but I’m trying to give you a full picture of my setup).

In my Firewall I have an Outbound Rule to allow TCP on port 25 for SMTP and a corresponding port forwarding rule on the router as well. My DNS has the following Setup:

Forward Lookup Zones
	*Company Name*
		Name: (same as parent folder); Type: (SOA); Data:  [1], win-rgdmldi7rnf., hostmaster.
		Name: (same as parent folder); Type: (NS); Data:  win-rgdmldi7rnf.
	*Company Name*.Homip.net
		Name: (same as parent folder); Type: (SOA); Data: [8], *server name*., hostmaster.
		Name: (same as parent folder); Type: (NS); Data:  *server name*.
		Name: Mail; Type: (A); Data: 192.168.X.X
		Name: Mail; Type: (MX); Data: [10] mail.*Company Name*.Homip.net.
Reverse Lookup Zones
		Name: (same as parent folder); Type: (SOA); Data:  [4], *server name*., hostmaster.
		Name: (same as parent folder); Type: (NS); Data:  *server name*.
		Name: 192.168.X.X; Type: (PTR); Data: mail.*Company Name*.Homip.net.

So now that you have the information here is what happens when I attempt to send an email. The code I have for the ASP page is correct (I have tested it on another server where email works and it ran fine). The web.config is also set correctly, for those of you interested here is the mail setting in the web.config of the page I am testing from:

<smtp from="max@bionex.ca">
<network defaultCredentials="false" host="localhost" password="XXXX" userName="XXXX" />

For comprehensiveness here is the code for the button click:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Label1.Text = "good?"
        'send email concerning the report
        'Instantiate a new instance of MailMessage
        Dim mMailMessage As New MailMessage()

        'Set the sender address of the mail message
        mMailMessage.From = New MailAddress("max@bionex.ca")
        'Set the recepient address of the mail message
        mMailMessage.To.Add(New MailAddress("max@bionex.ca"))

        'Set the subject of the mail message
        mMailMessage.Subject = "Subject"
        'Set the body of the mail message
        mMailMessage.Body = "Body"

        'Set the format of the mail message body as HTML
        mMailMessage.IsBodyHtml = True
        'Set the priority of the mail message to normal
        mMailMessage.Priority = MailPriority.High

        'Instantiate a new instance of SmtpClient
        Dim mSmtpClient As New SmtpClient("localhost")
        mSmtpClient.servicepoint.maxidletime = 1
        mSmtpClient.deliverymethod = smtpdeliverymethod.pickupdirectoryfromiis
        'Send the mail message
        'Catch ex As Exception
        'Label1.Text = "<h3>There Was an Error With The request</h3><p class='alert'>Please try again.<!--" & ex.ToString().Replace("-->", "- >") & "--></p>"
        'End Try
    End Sub

The page I am testing from has a button that on click sends an email to me, from me. When I send the message I look in my mailroot in inetpub and the email I send is stuck in the Queue Folder. All messages I send go to this folder and stay there until they go to badmail because they can never be delivered for some reason. No error message is displayed and the logs are not helpful. Finding information that is helpful on this topic is sparse, even with honed Google skills. I have read something about DNS SPF records and the fact that I might just be blocked as if I were spam (which is why maybe this is a DNS issue?) but even under the direction of this very informative page (http://old.openspf.org/dns.html) I was unable to make a difference with this problem. Is there anyone out there who might know how to solve this? If I have neglected any info that might prove useful in getting to the bottom of this let me know because like I said Networking and Server Administration are not my area of expertise really. Thanks for any help in advance!

Did you ever figure this out? I'm having the same problem.

Thank you its good sharing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.