[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Sending an HTML email using Outlook Express (No Outlook)

Posted on 2008-02-03
2
Medium Priority
?
947 Views
Last Modified: 2012-06-27
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)
0
Comment
Question by:rfwoolf
  • 2
2 Comments
 
LVL 13

Author Comment

by:rfwoolf
ID: 20808175
Here an example I found through google that HINTS about doing it but leave me lost:
===USELESS EXAMPLE 1===
http://groups.google.com.au/group/borland.public.delphi.oleautomation/browse_thread/thread/78c65f4bf215a1a5/49d9b742467f3252%2349d9b742467f3252
"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."
0
 
LVL 13

Accepted Solution

by:
rfwoolf earned 0 total points
ID: 20808255
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).
http://www.scalabium.com/faq/dct0115.htm

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

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

All you now need to do is generate your html in a Memo or wherever, and use
Memo1.Lines.SaveToFile('c\MyEmail.html');
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question