Mastodon
Programmierung

MailTo with Subject and Body

[code lang=”delphi”]function TMainForm.SendEMail(Recipient, Subject, Body: string): HINST;
var
MailMsg: string;
begin
MailMsg := Format(‘mailto:%s?subject=%s&body=%s’,
[Recipient, Subject, Body]);
Result := ShellExecute(Application.Handle,
‘open’,
PChar(MailMsg),
nil, nil,
SW_SHOWNORMAL);
end;
[/code]

usage:

[code lang=”delphi”] R := ‘anyone@anywhere.com’;
S := ‘New files’;
B := ‘Attached is NewFiles.zip; save attachment as
C:\Temp\NewFiles.zip’;
try
SendEMail(r, s, b);
except;
// whatever message you want to put up if it fails
end;
[/code]

Outlook Express does not allow automating attachments in code (i.e.,
it’s OLE-compromised). So your user will have to manually attach their
file after OE shows up.

[tags]Delphi, EMail[/tags]

0 Kommentare zu “MailTo with Subject and Body

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.