indy TidSMTP object: cannot send more than one attachment / multiple attachments
Hi All,
Using the SMTP and MESSAGE object I can send email with only one (1)
attachment fine. As soon as I try to attach more than one attachment,
the send method fails? I can do this using the DEMO application, so
clearly my code is wrong.
Could anyone please take a look at it?
Thanks for your help!!
-------------------------------------------------------------------------
mail.Host := myini.ReadString('mailsettings','mailserver','localhost');
mail.username := myini.ReadString('mailsettings','pop3id','localhost');
mail.Password := myini.ReadString('mailsettings','pop3pw','localhost');
msg.From.Address := myini.ReadString('mailsettings','address','');
msg.From.DisplayName :=
myini.ReadString('mailsettings','displayname','');
msg.From.Name := myini.ReadString('mailsettings','displayname','');
msg.Subject := myini.ReadString(mailsection,'subject','');
msg.Body.Add(myini.ReadString(mailsection,'body',''));
msg.Recipients.Add.Address := 's...@adress.net';
for teller := 0 to dumlist.count-1 do
begin
TIdAttachment.Create(msg.MessageParts,dumlist.Strings[teller]);
end;
try
mail.Connect;
mail.Send(msg);
finally
begin
mail.Disconnect;
end
end;
-------------------------------------------------------------------------
So again, if I execute this code with ONLY ONE attachment, it works
ok.