Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Mailadresse des Standardprofiles von Outlook auslesen... (https://www.delphipraxis.net/9692-mailadresse-des-standardprofiles-von-outlook-auslesen.html)

FriFra 1. Okt 2003 20:49


Mailadresse des Standardprofiles von Outlook auslesen...
 
Wie komme ich an die Mailadresse eines Outlook bzw. Outlook-express users?

Daniel B 1. Okt 2003 21:08

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Am einfachsten über die Registry:

HKCU\Software\Microsoft\Internet Account Manager\Accounts\xxxxxxxx

die xen geben die ID an des Account, der erste hätte z.B. 00000001.
Die Adresse steht dann in "SMTP Email Adress".

FriFra 1. Okt 2003 21:20

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Kann mal jemand testen ob das funzt?

Delphi-Quellcode:
function GetOEMail(DisplayName: boolean): string;
  var
    RDI: TRegistry;
    Konten: TStringList;
    n: integer;
  begin
    Result := '';
    RDI := nil;
    Konten := nil;
    RDI := TRegistry.Create;
    Konten := TStringList.Create;
    try
      RDI.RootKey := HKEY_CURRENT_USER;
      RDI.OpenKey('Software\Microsoft\Internet Account Manager\Accounts',
        False);
      RDI.GetKeyNames(Konten);
      for n := 0 to Konten.Count - 1 do
      begin
        RDI.CloseKey;
        RDI.OpenKey('Software\Microsoft\Internet Account Manager\Accounts\' +
          Konten[n], False);
        if RDI.ValueExists('SMTP Email Address') = True then
          if RDI.ReadString('SMTP Email Address') <> '' then
          begin
            if (DisplayName = True) and (RDI.ValueExists('SMTP Display Name') =
              True) then
              if RDI.ReadString('SMTP Display Name') <> '' then
                Result := Result + ', ' + RDI.ReadString('SMTP Display Name') +
                  ' <' + RDI.ReadString('SMTP Email Address') + '>'
              else
                Result := Result + ', ' + RDI.ReadString('SMTP Email Address')
            else
              Result := Result + ', ' + RDI.ReadString('SMTP Email Address');
          end;
      end;
    finally
      if Length(Result) > 0 then
        Result := Trim(copy(Result, 3, Length(Result)));
      RDI.Free;
      Konten.Free;
    end;
  end;
02.10.2003: Ich habe die Funktion noch etwas überarbeitet. Die Hinweise aus den Antworten und eine optionale Ausgabe inkl. DisplayName wurde eingebaut.

Daniel B 1. Okt 2003 21:24

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Bei mir gehts nur teilweise.

Ich habe in der Reg 7 Accounts, 5 sind Mail und zwei sind NGs.

Ich bekomme insgesamt von der Funktion, 5 Mail-Addys zurück, wobei die erste, die dritte und die fünfte die gleichen sind, was aber in wirklichkeit nicht der Fall ist.

Christian Seehase 1. Okt 2003 21:29

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Moin FriFra,

bei mir funzt es soweit.

BTW: try gehört hinter das Create. Wenn noch nichts erzeugt wurde gibt es auch noch keine Resourcen, die geschützt werden müssten.

Daniel B 1. Okt 2003 21:32

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Ach ja,
Delphi-Quellcode:
  RDI := nil;
  Konten := nil;
Bekommst Du keine Warnungen vom komplizierer?

FriFra 1. Okt 2003 21:39

Re: Mailadresse das Standardprofiles von Outlook auslesen...
 
Zitat:

Zitat von Daniel B
Ach ja,
Delphi-Quellcode:
  RDI := nil;
  Konten := nil;
Bekommst Du keine Warnungen vom komplizierer?

Danke für den Hinweis ;) Diese Warnungen habe ich bisher immer ignoriert... :oops:

Knn mir noch einer von euch Outlook Usern sagen, ob es auch mit Outlook (nicht Express) vom Office geht?

Duffy 3. Okt 2003 12:09

Re: Mailadresse des Standardprofiles von Outlook auslesen...
 
Hallo Frifra,
bei Outlook schau mal unter diesem Registry Schlüssel nach
Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook-Profilname
bye


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:03 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz