BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sending mail with Outlook 2007

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Byron Upchurch
Guest





PostPosted: Wed May 16, 2007 8:49 pm    Post subject: Sending mail with Outlook 2007 Reply with quote



How do I send e-mail using Outlook 2007? I am using D7, with the following
code, and it works well with Outlook 2003 and prior versions:

procedure TForm1.Button1Click(Sender: TObject);
var
MSOutlook, MSItem: OLEVariant;
begin
MSOutlook := CreateOleObject( 'Outlook.Application' ); // in ComObj.pas
MSItem := MSOutlook.CreateItem(0);
MSItem.To := 'nobody (AT) noplace (DOT) com';
MSItem.Subject := 'hello';
MSItem.Body := 'Some message';
MSItem.Send;
end;

When I try this method with Outlook 2007, nothing happens. Any ideas what I
might be doing wrong?

Byron Upchurch
Back to top
Dmitry Streblechenko
Guest





PostPosted: Wed May 16, 2007 10:11 pm    Post subject: Re: Sending mail with Outlook 2007 Reply with quote



Does the message get sent when you open Outlook?
Add the following code after creating an instance of the Outlook.Application
object.

NS := MSOutlook.GgetNamespace('MAPI')
NS.Logon;

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Byron Upchurch" <byron (AT) iqms (DOT) com> wrote in message
news:464b27a0$1 (AT) newsgroups (DOT) borland.com...
Quote:
How do I send e-mail using Outlook 2007? I am using D7, with the
following
code, and it works well with Outlook 2003 and prior versions:

procedure TForm1.Button1Click(Sender: TObject);
var
MSOutlook, MSItem: OLEVariant;
begin
MSOutlook := CreateOleObject( 'Outlook.Application' ); // in ComObj.pas
MSItem := MSOutlook.CreateItem(0);
MSItem.To := 'nobody (AT) noplace (DOT) com';
MSItem.Subject := 'hello';
MSItem.Body := 'Some message';
MSItem.Send;
end;

When I try this method with Outlook 2007, nothing happens. Any ideas what
I
might be doing wrong?

Byron Upchurch


Back to top
Byron Upchurch
Guest





PostPosted: Fri May 18, 2007 9:15 pm    Post subject: Re: Sending mail with Outlook 2007 Reply with quote



Hello Dmitry,

Thank you very much. This worked!

Byron



"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> wrote in message
news:464b3a89$1 (AT) newsgroups (DOT) borland.com...
Quote:
Does the message get sent when you open Outlook?
Add the following code after creating an instance of the
Outlook.Application object.

NS := MSOutlook.GgetNamespace('MAPI')
NS.Logon;

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Byron Upchurch" <byron (AT) iqms (DOT) com> wrote in message
news:464b27a0$1 (AT) newsgroups (DOT) borland.com...
How do I send e-mail using Outlook 2007? I am using D7, with the
following
code, and it works well with Outlook 2003 and prior versions:

procedure TForm1.Button1Click(Sender: TObject);
var
MSOutlook, MSItem: OLEVariant;
begin
MSOutlook := CreateOleObject( 'Outlook.Application' ); // in ComObj.pas
MSItem := MSOutlook.CreateItem(0);
MSItem.To := 'nobody (AT) noplace (DOT) com';
MSItem.Subject := 'hello';
MSItem.Body := 'Some message';
MSItem.Send;
end;

When I try this method with Outlook 2007, nothing happens. Any ideas
what I
might be doing wrong?

Byron Upchurch




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.