473,563 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Site Sending E-mail

We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the
client computer
The local user on the client is also defined as a local user on the server
with same name and password (and only in the Users group on the server too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site
Web.config snippet
<system.web>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

..aspx code-behind code snippet
string fromEmail = "do********@tes tingsendemail.c om";
string fromDisplayName = "Testing SendEmail";
string toEmail = "pe****@company .com";
string pathAndFile = @"D:\Temp\testi ng.log";
string exceptionInfo = "Testing SendEmail";

System.Net.Mail .SmtpClient smtpclient = new
System.Net.Mail .SmtpClient();
smtpclient.Deli veryMethod =
System.Net.Mail .SmtpDeliveryMe thod.PickupDire ctoryFromIis;

// For smtpclient.Host , I've tried "localhost" , I've tried
System.Net.Dns. GetHostName(),
// and I've tried not setting the property at all
// none of these work
//smtpclient.Host = System.Net.Dns. GetHostName();

// For smtpclient.Pick upDirectoryLoca tion, I've tried not setting it
and I've tried
// explicitly setting the path to the IIS pickup folder
// neither of these work
//smtpclient.Pick upDirectoryLoca tion =
@"C:\Inetpub\ma ilroot\Pickup";

// For smtpclient.Port , I've tried not setting it and I've tried
explicitly setting it to 25
// neither of these work
//smtpclient.Port = 25;

// For smtpclient.UseD efaultCredentia ls, I've tried not setting it
and I've tried
// setting it to true
// neither of these work
//smtpclient.UseD efaultCredentia ls = true;

System.Net.Mail .MailAddress from = new
System.Net.Mail .MailAddress(fr omEmail, fromDisplayName );
System.Net.Mail .MailAddress to = new
System.Net.Mail .MailAddress(to Email);
System.Net.Mail .Attachment attachment = new
System.Net.Mail .Attachment(pat hAndFile);

using (System.Net.Mai l.MailMessage message = new
System.Net.Mail .MailMessage(fr om, to))
{
message.Attachm ents.Add(attach ment);
message.Body = exceptionInfo;
message.Priorit y = System.Net.Mail .MailPriority.H igh;
message.Subject = "Testing SendEmail";

// EXCEPTION is throw here trying to call the Send method
smtpclient.Send (message);
}

attachment.Disp ose();
The exception details are: System.Net.Mail .SmtpException: Cannot get IIS
pickup directory.

From the client computer, I can navigate to the site and do whatever without
any problems. But, when the site tries to send an e-mail from the server
for the session started by the client in the scenario described above, it
fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario
work?
Thanks.

May 5 '06 #1
3 2351
Or, set the application pool/IUSR account to run as a domain account

Jeff

"dnuos" <no****@company .com> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the
client computer
The local user on the client is also defined as a local user on the server
with same name and password (and only in the Users group on the server
too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site
Web.config snippet
<system.web>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

.aspx code-behind code snippet
string fromEmail = "do********@tes tingsendemail.c om";
string fromDisplayName = "Testing SendEmail";
string toEmail = "pe****@company .com";
string pathAndFile = @"D:\Temp\testi ng.log";
string exceptionInfo = "Testing SendEmail";

System.Net.Mail .SmtpClient smtpclient = new
System.Net.Mail .SmtpClient();
smtpclient.Deli veryMethod =
System.Net.Mail .SmtpDeliveryMe thod.PickupDire ctoryFromIis;

// For smtpclient.Host , I've tried "localhost" , I've tried
System.Net.Dns. GetHostName(),
// and I've tried not setting the property at all
// none of these work
//smtpclient.Host = System.Net.Dns. GetHostName();

// For smtpclient.Pick upDirectoryLoca tion, I've tried not setting
it
and I've tried
// explicitly setting the path to the IIS pickup folder
// neither of these work
//smtpclient.Pick upDirectoryLoca tion =
@"C:\Inetpub\ma ilroot\Pickup";

// For smtpclient.Port , I've tried not setting it and I've tried
explicitly setting it to 25
// neither of these work
//smtpclient.Port = 25;

// For smtpclient.UseD efaultCredentia ls, I've tried not setting it
and I've tried
// setting it to true
// neither of these work
//smtpclient.UseD efaultCredentia ls = true;

System.Net.Mail .MailAddress from = new
System.Net.Mail .MailAddress(fr omEmail, fromDisplayName );
System.Net.Mail .MailAddress to = new
System.Net.Mail .MailAddress(to Email);
System.Net.Mail .Attachment attachment = new
System.Net.Mail .Attachment(pat hAndFile);

using (System.Net.Mai l.MailMessage message = new
System.Net.Mail .MailMessage(fr om, to))
{
message.Attachm ents.Add(attach ment);
message.Body = exceptionInfo;
message.Priorit y = System.Net.Mail .MailPriority.H igh;
message.Subject = "Testing SendEmail";

// EXCEPTION is throw here trying to call the Send method
smtpclient.Send (message);
}

attachment.Disp ose();
The exception details are: System.Net.Mail .SmtpException: Cannot get IIS
pickup directory.

From the client computer, I can navigate to the site and do whatever
without
any problems. But, when the site tries to send an e-mail from the server
for the session started by the client in the scenario described above, it
fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario
work?
Thanks.

May 5 '06 #2
You need to turn on Basic authentication. If you want it secure, then HTTPS
with Basic. Otherwise, Kerberos.

Jeff

"dnuos" <no****@company .com> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the
client computer
The local user on the client is also defined as a local user on the server
with same name and password (and only in the Users group on the server
too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site
Web.config snippet
<system.web>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

.aspx code-behind code snippet
string fromEmail = "do********@tes tingsendemail.c om";
string fromDisplayName = "Testing SendEmail";
string toEmail = "pe****@company .com";
string pathAndFile = @"D:\Temp\testi ng.log";
string exceptionInfo = "Testing SendEmail";

System.Net.Mail .SmtpClient smtpclient = new
System.Net.Mail .SmtpClient();
smtpclient.Deli veryMethod =
System.Net.Mail .SmtpDeliveryMe thod.PickupDire ctoryFromIis;

// For smtpclient.Host , I've tried "localhost" , I've tried
System.Net.Dns. GetHostName(),
// and I've tried not setting the property at all
// none of these work
//smtpclient.Host = System.Net.Dns. GetHostName();

// For smtpclient.Pick upDirectoryLoca tion, I've tried not setting
it
and I've tried
// explicitly setting the path to the IIS pickup folder
// neither of these work
//smtpclient.Pick upDirectoryLoca tion =
@"C:\Inetpub\ma ilroot\Pickup";

// For smtpclient.Port , I've tried not setting it and I've tried
explicitly setting it to 25
// neither of these work
//smtpclient.Port = 25;

// For smtpclient.UseD efaultCredentia ls, I've tried not setting it
and I've tried
// setting it to true
// neither of these work
//smtpclient.UseD efaultCredentia ls = true;

System.Net.Mail .MailAddress from = new
System.Net.Mail .MailAddress(fr omEmail, fromDisplayName );
System.Net.Mail .MailAddress to = new
System.Net.Mail .MailAddress(to Email);
System.Net.Mail .Attachment attachment = new
System.Net.Mail .Attachment(pat hAndFile);

using (System.Net.Mai l.MailMessage message = new
System.Net.Mail .MailMessage(fr om, to))
{
message.Attachm ents.Add(attach ment);
message.Body = exceptionInfo;
message.Priorit y = System.Net.Mail .MailPriority.H igh;
message.Subject = "Testing SendEmail";

// EXCEPTION is throw here trying to call the Send method
smtpclient.Send (message);
}

attachment.Disp ose();
The exception details are: System.Net.Mail .SmtpException: Cannot get IIS
pickup directory.

From the client computer, I can navigate to the site and do whatever
without
any problems. But, when the site tries to send an e-mail from the server
for the session started by the client in the scenario described above, it
fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario
work?
Thanks.

May 5 '06 #3
"dnuos" <no****@company .com> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
What's wrong? Am I missing something? How can I make the above scenario
work?


http://www.systemnetmail.com
May 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2877
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for...
5
2961
by: Florent | last post by:
Hi, I run a few sites and I want to log in my main site database when/if there is a problem, (like a page not found or an unknown agent). But I don't want to give direct access to my database to the other sites, so how could I safely pass data, (without passwords), from one site to another? Thanks. Simon
10
1980
by: Jim Evans | last post by:
Hi All I'm building a shopping cart that ties in with PayPal for payments. After working out the postage charge, I want the user to be able to confirm if they'll sign up to a newsletter or not, and then to be taken to Paypal. I'd like to do all that with just one click. Paypal only lets you pass one hidden variable, and I need that to...
4
2215
by: igthibau | last post by:
Hello everyone, well, the title says pretty much all. First off though I'd like to say I have no idea what ng I should post this to. I chose this one because I am more likely to understand c-based answers than other language's. So, my problem is simple : to submit a query to a search engine, one goes to , say www.google.com, enters keywords...
5
2676
by: Mr. x | last post by:
Hello, I am building a web-site. For a reason, I don't know why, if I put my site on my computer - I see hebrew character fine, but when I put my site on hosting company I don't see hebrew character. In my html page there is a line in the head section : <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
1
2125
by: Butch | last post by:
Hi, I won't lie to you. I'm trying to get data from html source from a 3rd party website. I'm NOT interested in stealing code,hacking,sending spam or anything sinister like that. I just want the content that is displayed but I need to get it automatically via VB. It's only publicly available price information but I don't think the website...
64
4214
by: Dave | last post by:
A friend of mine pointed out the other day that certain elements on my web site are too small. But in most of what I publish, fonts are at default size or smaller, and my images are easy to see. I am viewing at 800x600 right now by the way, because that's what I can comfortably see. Times New Roman default pitch is what - 12px? With...
16
2487
by: Ben Sehara | last post by:
Is there any way I can limit the access to my website? I have a site "A" and I want to allow access to it only from site "B" login user. If someone try to access site "A" directory, I want it redirected to site "B" for login. After login at site "B", you see the link to site"A". When you click it, you see login page for site "A". Is it...
10
3025
kamill
by: kamill | last post by:
Dear All, I need to send some data from my site to another site, but i do not want to hit that site. Is there any option. Currently i am using form to doing it but after submitting it, i do not want to transfer control to another site. I needed immediate help. Thanking you. Regards Kamill
9
1930
by: joe | last post by:
Hello, I have a website set up on our server that is especially for errors. When another website encounters an error, it will redirect to this site with error details in the querystring. The error website process the querystring and displays a nicely formatted error message with details. The problem I am having is that the querystrings...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.