Solved

SMTP Mail with ASP.NET error

Posted on 2010-09-08
1
755 Views
Last Modified: 2012-05-10
Hello,

I'm hosting a .net web app on Win Server 2008 R2.  I added the SMTP feature so I could send emails via code.  This worked fine, and I was able to send a very simple email.  

Well I then messed with installing Exchange Server on my Win Server, to create email accounts, then decided that was a bad idea.  I started the install process, saw how complex it was, then scrapped the idea.  Well, after that I started to get errors when emailing in my .net app.

I started seeing this error:
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for rgautreau@me.com

Then I read that I needed to add this code:
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

I did that, now I get this error:
Cannot get IIS pickup directory.

I am administering the Win Server (for the first time), so I don't need any network server.  Any suggestions as to what it wrong?

** Another thing to note **  I used to see the SMTP feature icon under IIS.  I could start and stop it there.  Now I can't find that anywhere.  I just see the SMTP-E-Mail Icon in the ASP.NET area of IIS.  Do I need to configure something here?  I told it to use localhost, but I still get the error.  


//Send the message.
        SmtpClient client = new SmtpClient("localhost");
        client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        client.Send(message);

Open in new window

0
Comment
Question by:JT_SIRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 30

Accepted Solution

by:
MlandaT earned 250 total points
ID: 33631575
I think the problem is the relay feature. is disabled. You can configure that in the SMTP virtual server as follows,

   1. On Genreal tab, Set IP address of the machine instead of "All Unassigned"
   2. In Access tab, click on Relay button, this will open Relay Restrictions dialog.
   3. Add 127.0.0.1 and IP address of the machine to the relay list.
   4. Restart the SMTP server and thats it.

You cannot do this through IIS7 because it does not have SMTP Virtual Server node as it shows in IIS 6.
You can find this under "Administrative Tools" of Windows from Control panel, there you will find both IIS 6 and IIS 7.
Open IIS 6 Manager and do the above mentioned settings of SMTP.

After doing this, you can actually leave out the:
        client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

Give that a try let's see if it works.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

OfficeMate Freezes on login or does not load after login credentials are input.
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question