Solved

SMTP Mail with ASP.NET error

Posted on 2010-09-08
1
754 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
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

830 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