473,698 Members | 2,178 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 2550
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
4306
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
3215
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
4163
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
2901
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
4372
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
3221
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
8557
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
8675
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
8604
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6521
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
5860
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
4370
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.