Solved

SMTP Mail with ASP.NET error

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
Suggested Courses

635 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