function TForm1.Send;
var
I: Integer;
St, Host, TempFile: AnsiString;
SMTP: TIdSMTP;
begin
SMTP := TIdSMTP.Create(
nil);
try
for I := 0
to Pred(FAttachments.Count)
do
if FileExists(FAttachments.Items[I])
then
with TIdAttachment.Create(FMsg.MessageParts, FAttachments.Items[I])
do
ContentType := '
';
{ DONE : determine content type }
for I := 0
to Pred(FTo.Count)
do
FMsg.Recipients.Add.Address := FTo[I];
for I := 0
to Pred(FCC.Count)
do
FMsg.CCList.Add.Address := FCC[I];
for I := 0
to Pred(FBCC.Count)
do
FMsg.BccList.Add.Address := FBCC[I];
{ TODO : 1
function TIdMessage.GenerateHeader: TIdHeaderList;
BCC Empfänger in Unit IDMessage müssen angegeben werden
nach Indy Update
}
FMsg.ContentType := FContentType;
FMsg.From.Address := FFromEMail;
FMsg.From.
Name := FFromName;
FMsg.Subject := FSubject;
if FMsg.MessageParts.TextPartCount = 0
then
FMsg.SetBody((FText
as IASPStringListInt).GetStringList)
else
with TIdText.Create(
FMsg.MessageParts, (FText
as IASPStringListInt).GetStringList
)
do
ContentType := FContentType;
SMTP.Host := '
mail.yourhost.com';
SMTP.Port := 25;
SMTP.Connect;
try
SMTP.Send(FMsg);
finally
SMTP.Disconnect;
end;
finally
SMTP.Free;
end;
end;