I figured out how to create an html email and send it from Delphi using Outlook. What I can't figure out is how to get the image to embed in the email without showing the attachment in Outlook. My client does not want to use 3rd party components, and I'd rather avoid the complexities of MAPI (as I'm not familiar with it). Is it possible with the regular Delphi Outlook components/automation?
I need the image to show in Outlook, but not the attachment. Also if anyone has tips on how to prevent extra Outlook processes being created, please feel free to critique - can't figure out what I'm not freeing.
Here's my code:
procedure TfrmTestEmail.btnSendClick(Sender: TObject);
NmSpace := OutlookApplication1.GetNamespace('MAPI');
NmSpace.Logon('', '', False, False);
MailItem1.ConnectTo(OutlookApplication1.CreateItem(olMailItem) as MailItem);
//no matter which value is used, the image is not being embedded
olByValue, // olAttachment, //olByValue, //olHTML, //olEmbeddeditem,
MailItem1.Subject := 'Test olByValue';
'<DIV align=center><IMG height=65 src="cid:logo" width=339 align=left> Test HTML </DIV> ';
// OutlookApplication1.Quit; //Don't really want to force the user to quit Outlook
on E: Exception do