As I personilize the E-mails per customer, I need to send them one-by-one.
When 1000 E-mail are send this way, the enduser of my app will have to wait until the all have finished. If attachments are added it will even take much longer.
What I'm looking for is a way to send the E-mail in an optional backgroudprocess.
During sending of the E-mails, the enduser can decide to wait for it all to happen, or to send it to the background and continue other work with the app.
Can anybody supply me with some codesample on how to accomplish this?
var IdSMTP: TIdSMTP;
I : Integer;
IdSMTP.Host:='my.domain.nl'; // replace by your outgoing server
IdSMTP.Username := 'MyUserName';
IdSMTP.Password := 'MyPassword';
if NOT IdSMTP.Connected then
For I := 0 to Query1.Recordcount -1 do
// Start some function to personalize body per customer
IdMsg.Body.Text := PersonalizeEmailForCustomer;
Showmessage('Error when sending E-mail');
if IdSMTP.Connected then