Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Re: invoke email client

www.cryer.info
Managed Newsgroup Archive

Re: invoke email client

Subject:Re: invoke email client
Posted by:"Peter" (peace39..@yahoo.com)
Date:Sun, 31 Dec 2006 17:37:32

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:45934445$1@newsgroups.borland.com...
>
> "Peter" <peace3977@yahoo.com> wrote in message
> news:45934320$1@newsgroups.borland.com...
>
>> Ok, I found MapiSendMail in the docs, looks like it will do what
>> I want, but where is the interface definition (what file do I have to
>> include in my uses clause) to use it from a Delphi Win32 app?
>
> Mapi.pas
>
>
> Gambit
>
>

Well, I put a call to MapiSendMail in my app, it always gets an error
MAPI_E_FAILURE
One or more unspecified errors occurred. No message was sent.
Not very helpful, here is my code, what I am I missing?

procedure TfrmMain.btnEmailClick(Sender: TObject);
var
  Msg : MapiMessage;
  Sendr : MapiRecipDesc;
  Recepr : MapiRecipDesc;
  MsgFlags : FLAGS;
  result : Integer;

begin
//  MAPI_LOGON_UI - Display logon UI
  MsgFlags := $00000001;
  Msg.nRecipCount := 1;
  Sendr.lpszAddress := 'peter@pfksystems.com';
  Recepr.lpszAddress := 'sysadmin@pfksystems.com';
  Msg.lpOriginator := @Sendr;
  Msg.lpRecips := @Recepr;
  Msg.lpszSubject := '';
  Msg.lpszNoteText :='';
  Msg.flFlags := MsgFlags;
  result := -1;
  try
    result := MapiSendMail(0,0,Msg,MsgFlags,0);
  finally
    sb.SimpleText := 'SendMail returned '+IntToStr(result);
  end;
end;

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive