Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SMTP Mail with ASP.NET error

Posted on 2010-09-08
1
Medium Priority
?
758 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 31

Accepted Solution

by:
MlandaT earned 1000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
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 tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

688 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