473,796 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# ASP.NEt calling Outlook Interop

Hi,

I am trying to send mail thru outlook. I have found some code on the web and
ws trying it out. I was successful in creating a mail in the draft folder of
outlook, however hangs for a long time during the sending of the mail.

Snippet code as below
-------------------------------------------

using Outlook = Microsoft.Offic e.Interop.Outlo ok; //using the 11.0 object
library

private Outlook.Applica tion oApp = null;
private Outlook.NameSpa ce oNameSpace = null;
private Outlook.MAPIFol der oOutboxFolder = null;

oApp = new Outlook.Applica tion();
oNameSpace= oApp.GetNamespa ce("MAPI");
oNameSpace.Logo n(null,null,tru e,true);
oOutboxFolder =
oNameSpace.GetD efaultFolder(Ou tlook.OlDefault Folders.olFolde rOutbox);

Outlook.MailIte mClass mi =
(Outlook.MailIt emClass)oApp.Cr eateItem(Outloo k.OlItemType.ol MailItem);
mi.To = "te**@test.com" ;
mi.Body = "Some Message";
mi.Subject = "Some Title";
mi.SaveSentMess ageFolder = oOutboxFolder;
mi.Save(); //works where i am able to see the mail in the draft folder
mi.Send(); //does not execute where the web page just stalls

-------------------------------------------------

Any help why this is happening, if the save() works, why does the send just
stalls and does not drop a mail in the outbox for sending.

Is there any settings on the server side which i miss?

I am running everything below on the same pc :-
Windows Server 2003 Enteprise Ed
..NET 1.1 Framework
MS IIS 6
MS Exchange 2003
Office 2003(Outlook 2003 and etc)

Thanks,

Joey
Nov 19 '05 #1
1 4894
Just a guess, but when using the Outlook Interop in this way you must give it
explicit commands. It's possible that you're sending the mail item to the
outbox with send, but not performing a send/receive.

Any reason you didn't just use the SMTP class???

Ryan

"Joey Lee" wrote:
Hi,

I am trying to send mail thru outlook. I have found some code on the web and
ws trying it out. I was successful in creating a mail in the draft folder of
outlook, however hangs for a long time during the sending of the mail.

Snippet code as below
-------------------------------------------

using Outlook = Microsoft.Offic e.Interop.Outlo ok; //using the 11.0 object
library

private Outlook.Applica tion oApp = null;
private Outlook.NameSpa ce oNameSpace = null;
private Outlook.MAPIFol der oOutboxFolder = null;

oApp = new Outlook.Applica tion();
oNameSpace= oApp.GetNamespa ce("MAPI");
oNameSpace.Logo n(null,null,tru e,true);
oOutboxFolder =
oNameSpace.GetD efaultFolder(Ou tlook.OlDefault Folders.olFolde rOutbox);

Outlook.MailIte mClass mi =
(Outlook.MailIt emClass)oApp.Cr eateItem(Outloo k.OlItemType.ol MailItem);
mi.To = "te**@test.com" ;
mi.Body = "Some Message";
mi.Subject = "Some Title";
mi.SaveSentMess ageFolder = oOutboxFolder;
mi.Save(); //works where i am able to see the mail in the draft folder
mi.Send(); //does not execute where the web page just stalls

-------------------------------------------------

Any help why this is happening, if the save() works, why does the send just
stalls and does not drop a mail in the outbox for sending.

Is there any settings on the server side which i miss?

I am running everything below on the same pc :-
Windows Server 2003 Enteprise Ed
..NET 1.1 Framework
MS IIS 6
MS Exchange 2003
Office 2003(Outlook 2003 and etc)

Thanks,

Joey

Nov 19 '05 #2

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

Similar topics

12
7289
by: guy lateur | last post by:
Hi all, I am trying to write some code (macro's, if you like) to glue together our Office applications (mainly Word, Excel and Outlook). We have a lot of different projects going on simultaneously. The idea is to develop a centralized framework (starting point, common interface) for my users to view/control their documents/correspondence, on a per project basis. As an example, I'd like to have a control (button, menu entry) in Outlook...
0
2033
by: W Akthar | last post by:
Hi All, I have created a simple Windows Service which needs to be able to send appointments to Outlook. I have no problem makeing a reference to Microsoft Outlook 11.0 Object Library and compiling the code. the problem arises when I try to install the service using installutil. The error message I get is the following
4
19325
by: John | last post by:
Hi Does anyone have a vb.net example of how to use redemption to send mail through outlook? Many Thanks Regards
9
6747
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
4
1386
by: Brett | last post by:
When I run this line: myolApp = CreateObject("Outlook.Application") The myolApp object has a value of {Outlook.ApplicationClass}. When I expand it in the watch window, all properties/methods of that object have a value of <error: an exception of type: {System.InvalidCastException} occured> I'm referencing the Outlook 10.0 Object Library (Interop.Outlook), which
2
7305
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a "Array index out of bounds". Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook._NameSpace olNs = olApp.GetNamespace("MAPI");
3
3412
by: mwolowski | last post by:
Hello, I'd like to add tasks, appointments, etc using c# to outlook For example i added reference using OutLook = Microsoft.Office.Interop.Outlook; and the code: 1. --------------------- OutLook._Application outlookObj = new OutLook.Application();
1
3226
by: =?Utf-8?B?cm9i?= | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox and server (Exchange server mail box) to connect and then save the mailitems(from Inbox or any other folder) based on a filter to a*.msg file. I want to achieve this using only one Interop dll if this is possible. Tried so far:
1
2872
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox and server (Exchange server mail box) to connect and then save the mailitems(from Inbox or any other folder) based on a filter to a*.msg file. I want to achieve this using only one Interop dll if this is possible. Tried so far:
0
9673
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
9525
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
10452
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
10169
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
10003
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...
0
9050
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
7546
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
6785
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();...
3
2924
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.