ben Guest
|
Posted: Fri Oct 22, 2004 7:52 pm Post subject: file to email body |
|
|
I am using the following code to attach a document to an email. I'm using
bcb6.0. Is there any way to put the formatted text directly into the email
body? The text file that I want to put in there is rtf, but I could
probably switch to html. Any help is greatly appreciated. Thanks,
Ben
AnsiString TempS;
Variant MSOutlook;
Variant TheNameSpace;
Variant MailMessage;
Variant Attachments;
Variant Source;
Source = Temp;
Variant Type;
Type = olByValue;
Variant Position;
Position = 4000;
Variant DisplayName;
DisplayName = "Work attachment";
MSOutlook = CreateOleObject("Outlook.Application") ;
TheNameSpace = MSOutlook.OleFunction("GetNamespace"
,WideString("MAPI"));
TheNameSpace.OleProcedure(WideString("Logon"),WideString("")
,WideString(""),WideString("TRUE"),WideString("True"));
MailMessage = MSOutlook.OleFunction("CreateItem" , (Variant)olMailItem);
TempS = "Case: " + MakeDCSProjectString(&DACurCase);
MailMessage.OlePropertySet("Subject" , WideString(TempS));
TempS = "A summary for case: " + MakeDCSProjectString(&DACurCase) + " "
+ Short(DACurCase.ProjForCaseID.Description) + " is contained in the PDF
attachment.nn";
MailMessage.OlePropertySet("Body" , WideString(TempS));
MailMessage.OleFunction("Save");
Attachments = MailMessage.OlePropertyGet("Attachments");
MailMessage.OleFunction("Save");
Attachments.OleFunction("Add",Source,Type,Position,DisplayName);
MailMessage.OleFunction("Display");
|
|