Dear All,
   Here i paste it my sample coding.I got the Access Voilation Error 
In this Line.Please help how to solve this.Anybody have another idea.I will 
apperciate u.Advance thanks to all
Kindly Regards
Siva
 
 
function Tecmail.SendMail(const Subject, Body,
                 
 SenderName, SenderEMail,
                 
 RecipientName, RecipientEMail: string): Integer;
var
  Message: TMapiMessage;
  lpSender, lpRecipient: TMapiRecipDesc;
  FileAttach: array of TMapiFileDesc;
  SM: TFNMapiSendMail;
  MAPIModule: HModule;
  i : integer;
begin
  FillChar(Message, SizeOf(Message), 0);
  with Message do
  begin
    if (Subject <> '') then
      lpszSubject := PChar(Subject);
    if (Body <> '') then
      lpszNoteText := PChar(Body);
    if (SenderEmail <> '') then
    begin
      lpSender.ulRecipClass := MAPI_ORIG;
      if (SenderName = '') then
        lpSender.lpszName := 
PChar(SenderEMail)
      else
        lpSender.lpszName := 
PChar(SenderName);
      lpSender.lpszAddress := PChar(SenderEmail);
      lpSender.ulReserved := 0;
      lpSender.ulEIDSize := 0;
      lpSender.lpEntryID := nil;
      lpOriginator := @lpSender;
    end;
    if (RecipientEmail <> '') then
    begin
      lpRecipient.ulRecipClass := MAPI_TO;
      if (RecipientName = '') then
        lpRecipient.lpszName := 
PChar(RecipientEMail)
      else
        lpRecipient.lpszName := 
PChar(RecipientName);
      lpRecipient.lpszAddress := PChar(RecipientEmail);
      lpRecipient.ulReserved := 0;
      lpRecipient.ulEIDSize := 0;
      lpRecipient.lpEntryID := nil;
      nRecipCount := 1;
      lpRecips := @lpRecipient;
    end
    else
      lpRecips := nil;
    nFileCount := memo2.Lines.Count;
    if (nFileCount <= 0) then
    begin
      nFileCount := 0;
      lpFiles := nil;
    end
    else
    begin
     for i := 0 to nFileCount-1 do
     begin
      with FileAttach[i] do
      Begin
//**      FillChar(files[0], SizeOf(files[0]), 0);
//**       flFlags   := 0;
       nPosition := Cardinal(-1);
//**       lpszPathName := PChar(memo2.Lines[i]);
       lpszPathName := PChar(memo2.Lines[i]);
       lpszFileName := nil;
       lpFileType   := nil;
       lpFiles := @ FileAttach[i];
      end;
     end;
     nFileCount := memo2.Lines.Count;
    end;
  end;
  MAPIModule := LoadLibrary(PChar(MAPIDLL));
  if MAPIModule = 0 then
    Result := -1
  else
    try
      @SM := GetProcAddress(MAPIModule, 
'MAPISendMail');
      if @SM <> nil then
      begin
        Result := SM(0, Application.Handle, 
Message, MAPI_DIALOG or MAPI_LOGON_UI, 0);
      end
      else
        Result := 1;
    finally
      FreeLibrary(MAPIModule);
    end;
  if Result <> 0 then
    MessageDlg('Error sending mail (' + IntToStr(Result) + ').', 
mtError,
[mbOK], 0);
end;


      Best Jokes, Best Friends, Best Food and more. Go to 
http://in.promos.yahoo.com/groups/bestofyahoo/

[Non-text portions of this message have been removed]

Reply via email to