tags:

views:

7810

answers:

4

Hi. I'm trying to configure a dedicated server that runs ASP.NET to send mail through the local IIS SMTP server but mail is getting stuck in the Queue folder and doesn't get delivered.

I'm using this code in an .aspx page to test:

<%@ Page Language="C#" AutoEventWireup="true" %>

<% new System.Net.Mail.SmtpClient("localhost").Send("[email protected]", 
    "[email protected]", "testing...", "Hello, world.com"); %>    

Then, I added the following to the Web.config file:

<system.net>
  <mailSettings>
    <smtp>
      <network host="localhost"/>
    </smtp>
  </mailSettings>
</system.net>

In the IIS Manager I've changed the following in the properties of the "Default SMTP Virtual Server".

General: [X] Enable Logging
Access / Authentication: [X] Windows Integrated Authentication
Access / Relay Restrictions: (o) Only the list below, Granted 127.0.0.1
Delivery / Advanced: Fully qualified domain name = thedomain.com

Finally, I run the SMTPDiag.exe tool like this:

C:\>smtpdiag.exe [email protected] [email protected]

Searching for Exchange external DNS settings.
Computer name is THEDOMAIN.
Failed to connect to the domain controller. Error: 8007054b

Checking SOA for gmail.com.
Checking external DNS servers.
Checking internal DNS servers.
SOA serial number match: Passed.

Checking local domain records.
Checking MX records using TCP: thedomain.com.
Checking MX records using UDP: thedomain.com.
Both TCP and UDP queries succeeded. Local DNS test passed.

Checking remote domain records.
Checking MX records using TCP: gmail.com.
Checking MX records using UDP: gmail.com.
Both TCP and UDP queries succeeded. Remote DNS test passed.

Checking MX servers listed for [email protected].
Connecting to gmail-smtp-in.l.google.com [209.85.199.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to gmail-smtp-in.l.google.com [209.85.199.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to gsmtp183.google.com [64.233.183.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gsmtp183.google.com.
Connecting to gsmtp147.google.com [209.85.147.27] on port 25.
Connecting to the server failed. Error: 10051
Failed to submit mail to gsmtp147.google.com.

I'm using ASP.NET 2.0, Windows 2003 Server and the IIS that comes with it.

Can you tell me what else to change to fix the problem?

Thanks


@mattlant

This is a dedicated server that's why I'm installing the SMTP manually.

EDIT: I use exchange so its a little different, but its called a smart host in exchange, but in plain SMTP service config i think its called something else. Cant remember exactly the setting name.

Thank you for pointing me at the Smart host field. Mail is getting delivered now.

In the Default SMTP Virtual Server properties, the Delivery tab, click Advanced and fill the "Smart host" field with the address that your provider gives you. In my case (GoDaddy) it was k2smtpout.secureserver.net.

More info here: http://help.godaddy.com/article/1283

+2  A: 

I find the best thing usually dpending on how much email there is, is to just forward the mail thru your ISP's SMTP server. Less headaches. Looks like thats where you are having issues, from your smtp to external servers, not asp.net to your smtp.

Just have your SMTP server set to send it to your isp, or you can configure asp.net to send to it.

EDIT: I use exchange so its a little different, but its called a smart host in exchange, but in plain SMTP service config i think its called something else. Cant remember exactly the setting name.

mattlant
A: 

By the looks of things your firewall isn't letting SMTP (TCP port 25) out of your network.

Duncan Smart
A: 

two really obvious questions (just in case they haven't been covered) 1. has windows firewall been disabled? 2. do you have a personal/company firewall that is preventing your mail from being sent?

DaveJustDave
A: 

The accepted answer to this question may help if you're trying to relay through gmail's SMTP server.

Simon_Weaver