Solved

SMTP Mail with ASP.NET error

Posted on 2010-09-08
1
751 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
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 the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now