Re: Sending email from a Delphi application



On Thu, 24 Aug 2006 17:46:00 GMT, "DIKonsult"
<dag.idoff@xxxxxxxxxxxxx> wrote:

Hi,
can a beginner get some help with how to create emails from my Delphi 6 or
Delphi 2005 application.

I whant to create mail using the default mail client, MSOutlook/Lotus Notes
mail client which ever is set as the default mail client on the computer,
add recipients, subject, a body text and a file attachemnt and display it
for the user to send.

//Dag


Try this:

var
S: array [0..255] of char;
Mail: String;
begin
Mail := 'mailto:e.brown@xxxxxxxxxxx' + '?subject=test';
StrPCopy(S, Mail);
ShellExecute(handle,'Open', S, nil, nil, SW_SHOW);
end;

This code will send an email to e.brown@xxxxxxxxxxx using the default
email client.

BTW, you might consider using Indy components, they're easy to use.
Have a look at TIdSmtp and TIdMessage I'd say.

.


Quantcast