Problems sending Mail in ASP.NET

I have set up my local SMTP Server to allow relaying to 127.0.0.1 and I have even opened up Port 25 and yet I cannot get mail to send out on my Windwos XP 64-Pit Pro computer.  All of the messages drop into the Pickup folder and then are moved to the Queue folder - where they sit forever.

The messages get to the SMTP server without any issues but they never leave - any ideas?
ktolaAsked:
Who is Participating?
 
ktolaConnect With a Mentor Author Commented:
For those people who are interested, I finally figured out my issues - here is how to configure IIS and your ASP.NET website:
SMTP Server Settings (i.e. Right-Click on SMTP Server in IIS and select Properties):
  1. Select the Default IP for the Server on the main tab
    1. This is usually the same as the IP Address of the main website
    2. Click on the Advanced button and make sure/change the port to 25
  2. Click on the Relay tab
    1. Click on Authentication and ensure that only Anonymous Access is checked
    2. Click on Connection and ensure that the All Except List Below is selected
    3. Click on Relay and Ensure that the Only The List Below option is selected
      1. Add both 127.0.0.1 and your Default IP Address to the list
  3. Close The SMTP Window
Go into your Web.Config file and make sure you add the following section:

<system.net>
     <mailSettings>
          <smtp from=YourEmail@Email.com>
               <network host="DEFAULT IP ADDRESS" password="" userName=""/>
          </smtp>
     </mailSettings>
</system.net>
The DEFAULT IP ADDRESS should equal the IP Address that you select in Step #1 above.
0
 
Ryan ChongCommented:
is your SMTP Services running and configured correctly?

is the sendusing property set correctly as 1 ?
0
 
ktolaAuthor Commented:
There is no such option when using the System.Net.Mail class in the .NET 3.5 framework.  I am using the default credentials as follows:
SmtpClient thisClient = new SmtpClient();
thisClient.UseDefaultCredentials = true;
thisClient.Send(thisMessage);
 
<system.net>
    <mailSettings>
      <smtp from="email@address.com">
        <network host="localhost" port="25" password="" userName="" />
      </smtp>
    </mailSettings>
  </system.net>

Open in new window

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ktolaAuthor Commented:
I have been doing some further testing and I wonder if the fact that I have a multi-homed computer is causing the issues.  When I looked at the properties of the SMTP Server, I noticed that it was reading all three of my network connection - 192.168.1.4, 10,10,90.1 and 10.10.90.4 (I run private connections for database and storage...).
Since the 192 address is the one pointing to the Internet, I enabled that IP to relay but that did not correct the issue - but now I am wondering if this is along the lines of the problem...
0
 
Ryan ChongCommented:
is the port 25 opened?

I'm something like this to send out emails in .NET Framework 3.5:
using System.Net.Mail;
 
//...
 
public static Boolean sendMail(String SenderName, String SenderEmail, String ReceiverName, String ReceiverEmail, String Subject, String Body, Boolean isHTML, String SMTPHost, int SMTPPort, Boolean isAuthenticationNeeded, String SMTPUserName, String SMTPUserPwd)
        {
            try
            {
                SmtpClient sclient = new SmtpClient(SMTPHost, SMTPPort);
                sclient.DeliveryMethod = SmtpDeliveryMethod.Network;
                if (isAuthenticationNeeded)
                {
                    sclient.Credentials = new System.Net.NetworkCredential(SMTPUserName, SMTPUserPwd);
                }
 
                MailMessage mail = new MailMessage();
                mail.Subject = Subject;
                mail.IsBodyHtml = isHTML;
                mail.Body = Body;
                mail.BodyEncoding = System.Text.Encoding.UTF8;
                if (SenderName == "")
                {
                    mail.From = new MailAddress(SenderEmail);
                }
                else
                {
                    mail.From = new MailAddress(SenderEmail, SenderName);
                }
                mail.SubjectEncoding = System.Text.Encoding.UTF8;
                if (ReceiverName == "")
                {
                    mail.To.Add(ReceiverEmail);
                }
                else
                {
                    mail.To.Add(new MailAddress(ReceiverEmail, ReceiverName));
                }
                sclient.Send(mail);
                return true;
            }
            catch (SmtpException)
            {
                return false;
            }
            catch (Exception)
            {
                return false;
            }       
        }

Open in new window

0
 
ktolaAuthor Commented:
Thank you for the code - I am already using most of those settings.  You can actually set most of those in the web.config file and then use the UseDefaultCredentials option when setting up the SmtpClient - this makes it easier to deploy solutions.
The messages are getting to the SMTP Server but being queued immediately and never transmitting.  My experience suggests that this is a relay issue with the SMTP server but I cannot figure out how to overcome the limitation.  I have no enabled the entire 10,, 192, and 127. subnets to relay and that STILL is not working...
I also do have Port 25 open
0
 
Ryan ChongCommented:
I'm not that familiar with subnets/relay things.... or do you have a chance to use external SMTP host to send out emails?
0
 
ktolaAuthor Commented:
I am using the same settings that I use to successfully send out emails on numerous Windows 2003 servers (all using a local SMTP server).  The essence of the settings are to enable relaying for the IP of interest, set the SMTP server to that same IP address and Port 80 and then point the web.config host to that IP address.
On Windows Server 2003 (and 2000), everything works fine - on Windows XP 64-BIt Pro, the email stay in the queue forever...
0
 
Ryan ChongCommented:
thanks for the sharing, cheers!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.