473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending Email With Outlook

Hi,

I'm trying to send email in our C# ASP.Net application using the Outlook 11
library. For a bunch of unimportant reasons (unimportant to this posting
that is) we have to do it this way and can't use SMTP.

When I run the application through Visual Studio.Net (by clicking debug in
either debug or release modes), it works fine and the email is sent. When I
run it by going to Internet Explorer directly and typing in my local host
address, the application just hangs and waits when it trys to send the
email. I do hear my machine make that alert noise as if a warning pop up
just opened, but none are there.

Is it not possible to do this? If it is, what do I have to do to so it
doesn't hang when run directly?


If you're curious, here's the code:
Outlook.Applica tion oApp = new Outlook.Applica tion();
Outlook.NameSpa ce oNS = oApp.GetNamespa ce("mapi");
oNS.Logon("user name", "password", false, true);
//or alternatively:
//oNS.Logon(Missi ng.Value, Missing.Value, true, true);
Outlook.MailIte m oMsg =
(Outlook.MailIt em)oApp.CreateI tem(Outlook.OlI temType.olMailI tem);
oMsg.Subject = "Testing";
oMsg.HTMLBody = "<HTML><HEAD><T ITLE>Sample
GIF</TITLE><BODY><P> Test</P></BODY></HTML>";
Outlook.Recipie nts oRecips = (Outlook.Recipi ents)oMsg.Recip ients;
Outlook.Recipie nt oRecip =
(Outlook.Recipi ent)oRecips.Add ("us*******@our domain.com");
oRecip.Resolve( );
oMsg.Send();
oNS.Logoff();
Nov 19 '05 #1
1 2557
Ok....Sorry. Let me clarify.

It works fine if it's ran in Internet Explorer, and it's ran on the machine
that hosts the site.

However, if you try to run it in FireFox, or you try to run it from a
different machine, it does not work.
Just waits and hangs till finally throwing the exception:
System.Runtime. InteropServices .COMException (0x80080005): Server execution
failed

On the server, as soon as the page tries to send an email, the server makes
that ding noise.

I'm sure it's a security or impersonation issue. My question is, can we get
this to work or does the security protection prevent it?


"John Smith" <m@ty.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Hi,

I'm trying to send email in our C# ASP.Net application using the Outlook 11 library. For a bunch of unimportant reasons (unimportant to this posting
that is) we have to do it this way and can't use SMTP.

When I run the application through Visual Studio.Net (by clicking debug in
either debug or release modes), it works fine and the email is sent. When I run it by going to Internet Explorer directly and typing in my local host
address, the application just hangs and waits when it trys to send the
email. I do hear my machine make that alert noise as if a warning pop up
just opened, but none are there.

Is it not possible to do this? If it is, what do I have to do to so it
doesn't hang when run directly?


If you're curious, here's the code:
Outlook.Applica tion oApp = new Outlook.Applica tion();
Outlook.NameSpa ce oNS = oApp.GetNamespa ce("mapi");
oNS.Logon("user name", "password", false, true);
//or alternatively:
//oNS.Logon(Missi ng.Value, Missing.Value, true, true);
Outlook.MailIte m oMsg =
(Outlook.MailIt em)oApp.CreateI tem(Outlook.OlI temType.olMailI tem);
oMsg.Subject = "Testing";
oMsg.HTMLBody = "<HTML><HEAD><T ITLE>Sample
GIF</TITLE><BODY><P> Test</P></BODY></HTML>";
Outlook.Recipie nts oRecips = (Outlook.Recipi ents)oMsg.Recip ients;
Outlook.Recipie nt oRecip =
(Outlook.Recipi ent)oRecips.Add ("us*******@our domain.com");
oRecip.Resolve( );
oMsg.Send();
oNS.Logoff();

Nov 19 '05 #2

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

Similar topics

15
4308
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
13
3223
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using this, it seems, that the user must install IIS on their computer. Isn't there a class that will detect whatever mail server is available on a computer and use that? How do I create this functionality without having the user add any other...
1
4170
by: Devonish | last post by:
I am composing an email with Access VB and then sending it from within Access. Everything works correctly (the email actually goes!) but Outlook ask some irritating questions that the user is required to answer. A summary of the relevant code is: Dim mailObj as Outlook.MailItem
17
2906
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be much appreciated likewise as I could instantiate them, otherwise please forgive the crossposting.) I'm sure I've seen posts here before criticising the practice of automating outlook for the purpose of programatically sending email, on the grounds that it's naff. Well now we're really landed in...
8
4379
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and got the following reply (exact quote): Exchange 5.5 uses IMS connector for communication between the internal and the external world. IMS is based on SMTP Protocol. For mail flow within the organization Exchange 5.5 uses Message Transfer...
9
3223
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on CDOmail. I don't want to use the Outlook reference because outlook prompts each time program access it and I have found a way to disable that. Can I use webmail with exchange? Thanks
7
8559
by: Paridevi | last post by:
Hai , i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any details. Pls its urgent for me. Can any one give me any idea about this. Thanks in advance Pari
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8148
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
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.