Creating mail with Redemption & Delphi

  • Thread starter Thread starter David Meiner
  • Start date Start date
D

David Meiner

Hi!

Working through hundreds of newsgroup items nobody seems to have problems
creating E-mails with Redemption.
But I have: I cannot get the body / HTML body of the E-mail filled.

The "To", "Subject" and "Attachment" get created correct - but the "body"
never shows anything.

My config: Delphi 5, Outlook 2002, Redemption trial - latest version.
Perhaps someone can help. Here's my code:

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleServer, Outlook2000, ComObj, ActiveX, Outlook_TLB,
Redemption_TLB, mapi;

(...)

procedure TForm1.Button1Click(Sender: TObject);
var
oItem,myFolder, sItem, myitems :variant;
Folder: Outlook_tlb.MAPIFolder;
NmSpace: NameSpace;
myMessage: TMapiMessage;
lpSender, lpRecepient: TMapiRecipDesc;
FileAttach: TMapiFileDesc;
SM: TFNMapiSendMail;
MAPIModule: HModule;
begin
outlookapplication.Connect;
NmSpace := outlookapplication.GetNamespace('MAPI');
NmSpace.Logon('', '', False, False);

oItem:=outlookapplication.CreateItem(olMailItem);

sItem:=CreateOleObject('Redemption.SafeMailItem');
oItem.Subject := 'my subject'; //ok.
oItem.save;
sItem.Item := oItem;

sItem.Recipients.Add('(e-mail address removed)'); //ok.
sItem.Attachments.Add('C:\test.dat'); //ok.

sItem.Body:='<html>not shown</html>'; //ok.
sItem.htmlBody:='<html>not shown</html>'; //ok.
sItem.bodyformat:=olFormatPlain;
sItem.save;

sItem:=0;
oitem:=0;
outlookapplication.Disconnect;

end;

Already tried oItem.save and sItem.save on different lines...

Regards,
David
 
I am not sure what you are trying to achieve with the following code:

sItem.Body:='<html>not shown</html>'; //ok.
sItem.htmlBody:='<html>not shown</html>'; //ok.
sItem.bodyformat:=olFormatPlain;

If you set the body format to olFormatPlain, wouldn't you expect that only
the plain text body will be available?
Since only reading Body and HTMLBody is blocked, OOM will work just fine,
you don't really need Redemption.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I tested the same app on my colleagues computer.

He has Outlook 2000 installed.
The program works perfect - the body has arrived in Outlook.

Are there any knows compatibility issues?

BTW: The content of the sample body doesn't matter - I tried all variations.
 
HTMLBody is exposed in Outlook 98 and up - this means you will be able to
support all versions of Outlook except Outlook 97.

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