Sending an HTML email using Outlook Express (No Outlook)

We really need this in the knowledge base and I can't seem to find much on google, and anything I do find only hints at an answer and offers no working examples.

I've managed to do this with Oulook (not Outlook Express) but I strictly need Outlook Express.

I'd like a working example if at all possible.

I have BDS 2006 (Delphi 2006)
LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rfwoolfAuthor Commented:
Here an example I found through google that HINTS about doing it but leave me lost:
"A hack that seems to work in both Outlook and OE is add an HTML attachment
and set the message body to nil. Not just an empty string, but nil. The HTML
attachment will be used as the message body."
rfwoolfAuthor Commented:
Okay I manged to find a solution..

here is a working example of how to send an email using MAPI which uses the default mail handling program (in many cases Outlook Express - and yes if you're worried that they might be using a different program you should find your own solution to that problem).

Then here's the part that executes the SendMail function:
procedure TForm1.Button1Click(Sender: TObject);
  SendMail('Re: mailing from Delphi', //Subject
           'Welcome to'#13#10'Mike Shkolnik', //body
           'c:\autoexec.bat', //attachment
           'your name', '', //sender name, senders address
           'Mike Shkolnik', ''); // recipient name, recipient address

Simply set the body to '' (blank -- I can't seem to set it to null or nil)
Set the attachment to your html file
procedure TForm1.Button1Click(Sender: TObject);
  SendMail('Re: mailing from Delphi',
           '', // Body is blank
           'c:\MyEmail.html', //Your html file
           'your name', '',
           'Mike Shkolnik', '');

All you now need to do is generate your html in a Memo or wherever, and use

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.