Jep og her har du noget af min kode, det er en aldatabase som sender mails når der kommer alarmer så du skal se bort fra database tingene
while not Eof do begin AppNo := FieldByName(\'intno\').AsString; AppName := FieldByName(\'intname\').AsString; AlText := FieldByName(\'AlText\').AsString; MessageMemo.Lines.Add(AppNo+ \' \' +AppName+ \' \' +AlText); NMSMTP1.Host := lEditMailServer.Text; with NMSMTP1 do begin QueryUser := TmySQLQuery.Create(Self); QueryUser.Database := MyDB; QueryUser.Close; QueryUser.SQL.Text := \'SELECT * FROM users WHERE Id = \'+IntToStr(IdSelectedUser); QueryUser.Open; while not QueryUser.Eof do begin if not NMSMTP1.Connected then begin try NMSMTP1.Connect; except on Exception do ShowMessage(\'Invalid Pop Mail Host IP Adress\'); end; end; if Connected then begin SendingMail := True; ClearParameters; PostMessage.Body.Clear; PostMessage.FromAddress := lEditFromMailadr.Text; PostMessage.FromName := lEditMailFromName.Text; PostMessage.ToAddress.Add(QueryUser.FieldByName(\'SMSPhoneNo\').AsString +\'@\'+ QueryUser.FieldByName(\'SMSAdr\').AsString); PostMessage.Subject := lEditMailSubject.Text; Memo1.Clear; Memo1.Lines.Add( QueryUser.FieldByName(\'SMSPhoneNo\').AsString +\'@\'+ QueryUser.FieldByName(\'SMSAdr\').AsString); Memo1.Lines.Add(AppNo+ \' \' +AppName+ \' \' +AlText); PostMessage.Body.AddStrings(Memo1.Lines); // NMSMTP1.PostMessage.LocalProgram := \'EmailBlast\'; SendMail; Application.ProcessMessages; end else ShowMessage(\'fail to sent\'); QueryUser.Next; end; //while not QueryUser.Eof do QueryUser.Free; end; Next; end; //while not QueryCheckAlarms.Eof do end; //with QueryCheckAlarms do if NMSMTP1.Connected then NMSMTP1.Disconnect;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.