AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Timeoutzeit für Mapi-Mail verlängern (D5 Pro)
Thema durchsuchen
Ansicht
Themen-Optionen

Timeoutzeit für Mapi-Mail verlängern (D5 Pro)

Offene Frage von "little_budda"
Ein Thema von little_budda · begonnen am 16. Nov 2007
Antwort Antwort
Benutzerbild von little_budda
little_budda

Registriert seit: 5. Mai 2006
Ort: Velbert
246 Beiträge
 
Delphi 2006 Professional
 
#1

Timeoutzeit für Mapi-Mail verlängern (D5 Pro)

  Alt 16. Nov 2007, 10:48
Hallo,

ich verwende folgenden Code unter Delphi 5 Pro um E-Mails zu verschicken.

Klappt normalerweise auch richtig klasse.
Nur auf einem recht langsamen PC schafft der Rechner es nicht den E-Mail-Client zu öffnen
um die Mail zu verschicken befor die SendMail-Funktion in timeout läuft.
In einem von 10 Fällen "friert" meine Anwendung auch beim verschicken der Mail ein.

Hier der Code:
Delphi-Quellcode:
function SendFileMail(const FileName: TStrArray; const Subject, BodyText, RecipAdress, CopyConAdress: string): string;
var
  mMessage : TMapiMessage;
  mlpFiles : array of TMapiFileDesc;
  mRecips : array of TMapiRecipDesc;
  ix : integer;
begin
  SetLength(mRecips, 2);
  with mRecips[0] do
    begin
      ulRecipClass := MAPI_TO;
      lpszName := PChar(RecipAdress);
      lpszAddress := PChar(RecipAdress);
      ulEIDSize := 0;
      lpEntryID := nil;
    end;
  with mRecips[1] do
    begin
      ulRecipClass := MAPI_CC;
      lpszName := PChar(CopyConAdress);
      lpszAddress := PChar(CopyConAdress);
      ulEIDSize := 0;
      lpEntryID := nil;
    end;

  SetLength(mlpFiles, Length(FileName));

  for ix := 0 to High(mlpFiles) do
    begin
      with mlpFiles[ix] do
        begin
          flFlags := 0;
          nPosition := Cardinal(-1);
          // nPosition := 0;
          lpszPathName := PChar(FileName[ix]);
          lpszFileName := nil;
          lpFileType := nil;
        end;
    end;

  with mMessage do
    begin
      lpszSubject := PChar(Subject);
      lpszNoteText := PChar(BodyText);
      lpszMessageType := nil;
      lpszDateReceived := nil;
      lpszConversationID := nil;
      flFlags := 0;
      lpOriginator := nil;
      nRecipCount := 2;
      lpRecips := @mRecips[0];

      nFileCount := Length(FileName);

      if (nFileCount > 0)
        then lpFiles := @mlpFiles[0]
        else lpFiles := nil;

      // nFileCount := 1;
      // lpFiles := @mlpFiles;
    end;

  case MapiSendMail(0, 0, mMessage, MAPI_LOGON_UI or MAPI_NEW_SESSION, 0) of
    MAPI_E_AMBIGUOUS_RECIPIENT:
      Result := 'A recipient matched more than one of the recipient descriptor structures and MAPI_DIALOG was not set!';
    MAPI_E_ATTACHMENT_NOT_FOUND:
      Result := 'The specified attachment was not found!';
    MAPI_E_ATTACHMENT_OPEN_FAILURE:
      Result := 'The specified attachment could not be open!';
    MAPI_E_BAD_RECIPTYPE:
      Result := 'The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC!';
    MAPI_E_FAILURE:
      Result := 'One or more unspecified errors occurred!';
    MAPI_E_INSUFFICIENT_MEMORY:
      Result := 'There was insufficient memory to proceed!';
    MAPI_E_LOGIN_FAILURE:
      Result := 'There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed!';
    MAPI_E_TEXT_TOO_LARGE:
      Result := 'The text in the message was too large to sent!';
    MAPI_E_TOO_MANY_FILES:
      Result := 'There were too many file attachments!';
    MAPI_E_TOO_MANY_RECIPIENTS:
      Result := 'There were too many recipients!';
    MAPI_E_UNKNOWN_RECIPIENT:
      Result := 'A recipient did not appear in the address list!';
    MAPI_E_USER_ABORT:
      Result := 'The user canceled one of the dialog boxes!';
  end;
end;
Hat jemand eine Idee für mich wie ich die Timeout-Zeit für die SendMail-Funktion setzen kann
oder wie ich mein "einfrieren" behebe?

Holger
Glück findet sich nicht im Code
Gefahren werden ist nur solange schön wie man selbst nicht lenken möchte ...
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:30 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