Re: Sending email from a Delphi application



Hi John,
look simple enough, thanks a lot.
I presume that if I need a bodytext I write:
Mail := 'mailto:e.brown@xxxxxxxxxxx' + '?subject=test'+'?Body='This is a
body text in my mail';

or have I got it wrong?

Could you please explain to me whats actually happening with this call.

Dag

"John" <john@xxxxxxxxxxx> skrev i meddelandet
news:OYZGUJLT38953.7603587963@xxxxxxxxxxxxxxxxxxx
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