Mega Code Archive

 
Categories / Delphi / Activex OLE
 

Microsoft outlookta tanimli mail hesaplarinin alinmasi

{ Daha fazla bilgi ve detay icin Registry'de HKEY_CURRENT_USER anahtarinin altinda Software\Microsoft\Internet Account Manager\Accounts 'a bakiniz. } uses registry; function GetEMailAccounts: string; var Emails, Res: TStrings; AccountName, EmailTemp: string; POP3Server, POP3User, SMTPServer, SMTPName, SMTPEmailAdress: string; i: integer; begin Emails := TStringlist.create; Res := TStringlist.create; with TRegistry.Create do begin RootKey := HKEY_CURRENT_USER; LazyWrite := false; if KeyExists('Software\Microsoft\Internet Account Manager\Accounts') then OpenKey('Software\Microsoft\Internet Account Manager\Accounts', false); GetKeyNames(Emails); CloseKey; if Emails.Count > 0 then begin for i := 0 to Emails.Count - 1 do begin OpenKey('Software\Microsoft\Internet Account Manager\Accounts\' + Emails.Strings[i], False); AccountName := ReadString('Account Name'); POP3Server := ReadString('POP3 Server'); POP3User := ReadString('POP3 User Name'); SMTPServer := ReadString('SMTP Server'); SMTPName := ReadString('SMTP Display Name'); SMTPEmailAdress := ReadString('SMTP Email Address'); if AccountName = '' then AccountName := 'name not found'; if POP3User = '' then POP3User := 'login not found'; if SMTPName = '' then SMTPName := 'name not found'; if SMTPEmailAdress = '' then SMTPEmailAdress := 'email not found'; EmailTemp := '"' + AccountName + '": ' + SMTPName + ' <' + SMTPEMailAdress + '> (' + POP3User + '; ' + POP3Server + '/' + SMTPServer; if POP3Server <> '' then begin if SMTPServer <> '' then begin Res.Add(EmailTemp); end; end; CloseKey; end; Destroy; end; //with Emails.Free; end; if Res.count = 0 then Res.Add('(email accounts not found)'); Result := ReS.Text; Res.Free; end;